[llvm-commits] [llvm] r89468 - /llvm/trunk/lib/Analysis/CaptureTracking.cpp
Dan Gohman
gohman at apple.com
Fri Nov 20 09:50:21 PST 2009
Author: djg
Date: Fri Nov 20 11:50:21 2009
New Revision: 89468
URL: http://llvm.org/viewvc/llvm-project?rev=89468&view=rev
Log:
Revert the rule that considers comparisons between two pointers in the
same object to be a non-capture; Duncan pointed out a way that such
a comparison could be a capture.
Make the rule that considers a comparison against null more specific,
and only consider noalias return values compared against null. This
still supports test/Transforms/GVN/nonescaping-malloc.ll, and is not
susceptible to the problem Duncan pointed out with noalias arguments.
Modified:
llvm/trunk/lib/Analysis/CaptureTracking.cpp
Modified: llvm/trunk/lib/Analysis/CaptureTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CaptureTracking.cpp?rev=89468&r1=89467&r2=89468&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CaptureTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/CaptureTracking.cpp Fri Nov 20 11:50:21 2009
@@ -106,19 +106,14 @@
}
break;
case Instruction::ICmp:
- // Don't count comparisons of the original value against null as captures.
- // This allows us to ignore comparisons of malloc results with null,
- // for example.
- if (isIdentifiedObject(V))
+ // Don't count comparisons of a no-alias return value against null as
+ // captures. This allows us to ignore comparisons of malloc results
+ // with null, for example.
+ if (isNoAliasCall(V))
if (ConstantPointerNull *CPN =
dyn_cast<ConstantPointerNull>(I->getOperand(1)))
if (CPN->getType()->getAddressSpace() == 0)
break;
- // Don't count comparisons of two pointers within the same object
- // as captures.
- if (I->getOperand(0)->getUnderlyingObject() ==
- I->getOperand(1)->getUnderlyingObject())
- break;
// Otherwise, be conservative. There are crazy ways to capture pointers
// using comparisons.
return true;
More information about the llvm-commits
mailing list