diff options
author | Dan Gohman <gohman@apple.com> | 2009-11-20 01:34:03 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-11-20 01:34:03 +0000 |
commit | 7a958d37a1ed34b2160bbdc7371b1d15641acb2d (patch) | |
tree | 05d6d9fd8544158098bd8f49e9b150fc6a551578 /lib | |
parent | 222f68489f8cf17fa316ad1028c285326d830214 (diff) | |
download | external_llvm-7a958d37a1ed34b2160bbdc7371b1d15641acb2d.zip external_llvm-7a958d37a1ed34b2160bbdc7371b1d15641acb2d.tar.gz external_llvm-7a958d37a1ed34b2160bbdc7371b1d15641acb2d.tar.bz2 |
Simplify this code; it's not necessary to check isIdentifiedObject here
because if the results from getUnderlyingObject match, the values must
be from the same underlying object, even if we don't know what that
object is.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89434 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/CaptureTracking.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/Analysis/CaptureTracking.cpp b/lib/Analysis/CaptureTracking.cpp index e86ad96..1db9f2d 100644 --- a/lib/Analysis/CaptureTracking.cpp +++ b/lib/Analysis/CaptureTracking.cpp @@ -105,7 +105,7 @@ bool llvm::PointerMayBeCaptured(const Value *V, Worklist.push_back(U); } break; - case Instruction::ICmp: { + 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. @@ -114,16 +114,14 @@ bool llvm::PointerMayBeCaptured(const Value *V, dyn_cast<ConstantPointerNull>(I->getOperand(1))) if (CPN->getType()->getAddressSpace() == 0) break; - // Don't count comparisons of two pointers within the same identified - // object as captures. - Value *O0 = I->getOperand(0)->getUnderlyingObject(); - if (isIdentifiedObject(O0) && - O0 == I->getOperand(1)->getUnderlyingObject()) + // 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; - } default: // Something else - be conservative and say it is captured. return true; |