Skip to content

Commit 8148b11

Browse files
committed
[ValueTracking] Short-circuit GEP known bits calculation (NFC)
Don't compute known bits of all GEP operands, if we already know that we don't know anything.
1 parent b7e2358 commit 8148b11

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,10 @@ static void computeKnownBitsFromOperator(const Operator *I,
14541454

14551455
gep_type_iterator GTI = gep_type_begin(I);
14561456
for (unsigned i = 1, e = I->getNumOperands(); i != e; ++i, ++GTI) {
1457+
// TrailZ can only become smaller, short-circuit if we hit zero.
1458+
if (TrailZ == 0)
1459+
break;
1460+
14571461
Value *Index = I->getOperand(i);
14581462
if (StructType *STy = GTI.getStructTypeOrNull()) {
14591463
// Handle struct member offset arithmetic.

0 commit comments

Comments
 (0)