Skip to content

Commit 6d919f1

Browse files
author
Dan Gohman
committed
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. llvm-svn: 89434
1 parent c5d28f2 commit 6d919f1

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

llvm/lib/Analysis/CaptureTracking.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ bool llvm::PointerMayBeCaptured(const Value *V,
105105
Worklist.push_back(U);
106106
}
107107
break;
108-
case Instruction::ICmp: {
108+
case Instruction::ICmp:
109109
// Don't count comparisons of the original value against null as captures.
110110
// This allows us to ignore comparisons of malloc results with null,
111111
// for example.
@@ -114,16 +114,14 @@ bool llvm::PointerMayBeCaptured(const Value *V,
114114
dyn_cast<ConstantPointerNull>(I->getOperand(1)))
115115
if (CPN->getType()->getAddressSpace() == 0)
116116
break;
117-
// Don't count comparisons of two pointers within the same identified
118-
// object as captures.
119-
Value *O0 = I->getOperand(0)->getUnderlyingObject();
120-
if (isIdentifiedObject(O0) &&
121-
O0 == I->getOperand(1)->getUnderlyingObject())
117+
// Don't count comparisons of two pointers within the same object
118+
// as captures.
119+
if (I->getOperand(0)->getUnderlyingObject() ==
120+
I->getOperand(1)->getUnderlyingObject())
122121
break;
123122
// Otherwise, be conservative. There are crazy ways to capture pointers
124123
// using comparisons.
125124
return true;
126-
}
127125
default:
128126
// Something else - be conservative and say it is captured.
129127
return true;

0 commit comments

Comments
 (0)