[llvm-commits] [llvm] r132195 - /llvm/trunk/lib/Transforms/Scalar/LICM.cpp
Eli Friedman
eli.friedman at gmail.com
Fri May 27 11:04:04 PDT 2011
Author: efriedma
Date: Fri May 27 13:04:04 2011
New Revision: 132195
URL: http://llvm.org/viewvc/llvm-project?rev=132195&view=rev
Log:
Oops, wasn't intending to commit this. Partial revert of r132194.
Modified:
llvm/trunk/lib/Transforms/Scalar/LICM.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=132195&r1=132194&r2=132195&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Fri May 27 13:04:04 2011
@@ -372,11 +372,7 @@
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 @@
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; ) {
More information about the llvm-commits
mailing list