Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: src/IceTargetLowering.cpp

Issue 417353003: Fix bug when atomic load is fused with an arith op (and not in the entry BB) (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: review Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLowering.cpp
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
index 2a9b8c431ac6fbd42cabba5f8bfb9384017829bb..0034de5f7ca3e2340eb15e52f23530dfafc8ca56 100644
--- a/src/IceTargetLowering.cpp
+++ b/src/IceTargetLowering.cpp
@@ -26,11 +26,12 @@ namespace Ice {
void LoweringContext::init(CfgNode *N) {
Node = N;
- Cur = getNode()->getInsts().begin();
+ Begin = getNode()->getInsts().begin();
+ Cur = Begin;
End = getNode()->getInsts().end();
skipDeleted(Cur);
Next = Cur;
- advance(Next);
+ advanceForward(Next);
}
void LoweringContext::insert(Inst *Inst) {
@@ -43,13 +44,26 @@ void LoweringContext::skipDeleted(InstList::iterator &I) const {
++I;
}
-void LoweringContext::advance(InstList::iterator &I) const {
+void LoweringContext::advanceForward(InstList::iterator &I) const {
if (I != End) {
++I;
skipDeleted(I);
}
}
+void LoweringContext::advanceBackward(InstList::iterator &I) const {
+ assert(I != Begin);
+ do {
+ --I;
+ } while (I != Begin && (*I)->isDeleted());
+}
+
+Inst *LoweringContext::getLastInserted() const {
+ InstList::iterator Cursor = Next;
+ advanceBackward(Cursor);
+ return *Cursor;
+}
+
TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) {
// These statements can be #ifdef'd to specialize the code generator
// to a subset of the available targets. TODO: use CRTP.
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698