Index: src/IceTargetLowering.cpp |
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp |
index 057a3eaf8f05f195504087255e868c0bc839f549..71788dfc8dd011b03b5ab8f1bccdea0ff181370f 100644 |
--- a/src/IceTargetLowering.cpp |
+++ b/src/IceTargetLowering.cpp |
@@ -136,6 +136,10 @@ void TargetLowering::doNopInsertion() { |
void TargetLowering::lower() { |
assert(!Context.atEnd()); |
Inst *Inst = *Context.getCur(); |
+ // Mark the current instruction as deleted before lowering, |
+ // otherwise the Dest variable will likely get marked as non-SSA. |
+ // See Variable::setDefinition(). |
+ Inst->setDeleted(); |
switch (Inst->getKind()) { |
case Inst::Alloca: |
lowerAlloca(llvm::dyn_cast<InstAlloca>(Inst)); |
@@ -200,7 +204,6 @@ void TargetLowering::lower() { |
Func->setError("Can't lower unsupported instruction type"); |
break; |
} |
- Inst->setDeleted(); |
postLower(); |