Skip to content

Commit cac98c1

Browse files
committed
Use bool First instead
1 parent 8e5f7b8 commit cac98c1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6615,10 +6615,15 @@ const Value *llvm::getUnderlyingObjectAggressive(const Value *V) {
66156615
SmallPtrSet<const Value *, 8> Visited;
66166616
SmallVector<const Value *, 8> Worklist;
66176617
Worklist.push_back(V);
6618-
const Value *Object = nullptr, *FirstObject = nullptr;
6618+
const Value *Object = nullptr;
6619+
// Used as fallback if we can't find a common underlying object through
6620+
// recursion.
6621+
bool First = true;
6622+
const Value *FirstObject = getUnderlyingObject(V);
66196623
do {
66206624
const Value *P = Worklist.pop_back_val();
6621-
P = getUnderlyingObject(P);
6625+
P = First ? FirstObject : getUnderlyingObject(P);
6626+
First = false;
66226627

66236628
if (!FirstObject)
66246629
FirstObject = P;

0 commit comments

Comments
 (0)