[llvm-commits] [llvm] r40933 - /llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
Owen Anderson
resistor at mac.com
Wed Aug 8 10:58:57 PDT 2007
Author: resistor
Date: Wed Aug 8 12:58:56 2007
New Revision: 40933
URL: http://llvm.org/viewvc/llvm-project?rev=40933&view=rev
Log:
Small improvement: if a function doesn't access memory, we don't need to scan
it for potentially undeading pointers.
Modified:
llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp?rev=40933&r1=40932&r2=40933&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Wed Aug 8 12:58:56 2007
@@ -287,6 +287,13 @@
deadPointers.erase(A);
continue;
} else if (CallSite::get(BBI).getInstruction() != 0) {
+ // If this call does not access memory, it can't
+ // be undeadifying any of our pointers.
+ CallSite CS = CallSite::get(BBI);
+ if (CS.getCalledFunction() &&
+ AA.doesNotAccessMemory(CS.getCalledFunction()))
+ continue;
+
// Remove any pointers made undead by the call from the dead set
std::vector<Instruction*> dead;
for (SmallPtrSet<AllocaInst*, 64>::iterator I = deadPointers.begin(),
@@ -298,8 +305,7 @@
TD.getTypeSize((*I)->getAllocatedType());
// See if the call site touches it
- AliasAnalysis::ModRefResult A = AA.getModRefInfo(CallSite::get(BBI),
- *I, pointerSize);
+ AliasAnalysis::ModRefResult A = AA.getModRefInfo(CS, *I, pointerSize);
if (A == AliasAnalysis::ModRef || A == AliasAnalysis::Ref)
dead.push_back(*I);
}
More information about the llvm-commits
mailing list