aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Target/PowerPC/PPC32ISelSimple.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/Target/PowerPC/PPC32ISelSimple.cpp b/lib/Target/PowerPC/PPC32ISelSimple.cpp
index f2b5cec2e1..4793e4b73c 100644
--- a/lib/Target/PowerPC/PPC32ISelSimple.cpp
+++ b/lib/Target/PowerPC/PPC32ISelSimple.cpp
@@ -1928,15 +1928,16 @@ void PPC32ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) {
BB->getInstList().erase(CI);
break;
}
- default:
+ default: {
// All other intrinsic calls we must lower.
- Instruction *Before = CI->getPrev();
+ BasicBlock::iterator me(CI);
+ bool atBegin(BB->begin() == me);
+ if (!atBegin)
+ --me;
TM.getIntrinsicLowering().LowerIntrinsicCall(CI);
- if (Before) { // Move iterator to instruction after call
- I = Before; ++I;
- } else {
- I = BB->begin();
- }
+ // Move iterator to instruction after call
+ I = atBegin ? BB->begin() : ++me;
+ }
}
}