File tree Expand file tree Collapse file tree 1 file changed +8
-13
lines changed Expand file tree Collapse file tree 1 file changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -6615,18 +6615,19 @@ const Value *llvm::getUnderlyingObjectAggressive(const Value *V) {
6615
6615
SmallPtrSet<const Value *, 8 > Visited;
6616
6616
SmallVector<const Value *, 8 > Worklist;
6617
6617
Worklist.push_back (V);
6618
- const Value *Object = nullptr ;
6618
+ const Value *Object = nullptr , *FirstObject = nullptr ;
6619
6619
do {
6620
6620
const Value *P = Worklist.pop_back_val ();
6621
6621
P = getUnderlyingObject (P);
6622
6622
6623
+ if (!FirstObject)
6624
+ FirstObject = P;
6625
+
6623
6626
if (!Visited.insert (P).second )
6624
6627
continue ;
6625
6628
6626
- if (Visited.size () == MaxVisited) {
6627
- Object = nullptr ;
6628
- break ;
6629
- }
6629
+ if (Visited.size () == MaxVisited)
6630
+ return FirstObject;
6630
6631
6631
6632
if (auto *SI = dyn_cast<SelectInst>(P)) {
6632
6633
Worklist.push_back (SI->getTrueValue ());
@@ -6641,16 +6642,10 @@ const Value *llvm::getUnderlyingObjectAggressive(const Value *V) {
6641
6642
6642
6643
if (!Object)
6643
6644
Object = P;
6644
- else if (Object != P) {
6645
- Object = nullptr ;
6646
- break ;
6647
- }
6645
+ else if (Object != P)
6646
+ return FirstObject;
6648
6647
} while (!Worklist.empty ());
6649
6648
6650
- // If we tried looking through phi/select but did not end up with a single
6651
- // underlying object, fall back to the non-recursive underlying object of V.
6652
- if (!Object)
6653
- return getUnderlyingObject (V);
6654
6649
return Object;
6655
6650
}
6656
6651
You can’t perform that action at this time.
0 commit comments