summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-05-27 18:04:04 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-05-27 18:04:04 +0000
commitb868c83e6734d7b72c9d8b0f1e60b09365be5dc0 (patch)
treee1ef4407784f4cd0bff7e4386ec1bc250c793a29
parentfe84bd659cfb5432b7be77ede5809ccb16709581 (diff)
downloadbcm5719-llvm-b868c83e6734d7b72c9d8b0f1e60b09365be5dc0.tar.gz
bcm5719-llvm-b868c83e6734d7b72c9d8b0f1e60b09365be5dc0.zip
Oops, wasn't intending to commit this. Partial revert of r132194.
llvm-svn: 132195
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 935cd5d1ee4..d42d4ff837b 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -372,11 +372,7 @@ bool LICM::canSinkOrHoistInst(Instruction &I) {
return !pointerInvalidatedByLoop(LI->getOperand(0), Size,
LI->getMetadata(LLVMContext::MD_tbaa));
} else if (CallInst *CI = dyn_cast<CallInst>(&I)) {
- // Don't sink or hoist dbg info; it's legal, but not useful.
- if (isa<DbgInfoIntrinsic>(I))
- return false;
-
- // Handle simple cases by querying alias analysis.
+ // Handle obvious cases efficiently.
AliasAnalysis::ModRefBehavior Behavior = AA->getModRefBehavior(CI);
if (Behavior == AliasAnalysis::DoesNotAccessMemory)
return true;
@@ -526,7 +522,14 @@ void LICM::sink(Instruction &I) {
SSA.AddAvailableValue(ExitBlock, New);
}
- assert(NumInserted && "We shouldn't see dead instructions here!");
+ // If the instruction doesn't dominate any exit blocks, it must be dead.
+ if (NumInserted == 0) {
+ CurAST->deleteValue(&I);
+ if (!I.use_empty())
+ I.replaceAllUsesWith(UndefValue::get(I.getType()));
+ I.eraseFromParent();
+ return;
+ }
// Next, rewrite uses of the instruction, inserting PHI nodes as needed.
for (Value::use_iterator UI = I.use_begin(), UE = I.use_end(); UI != UE; ) {
OpenPOWER on IntegriCloud