Skip to content

Commit

Permalink
[ValueTracking] Short-circuit GEP known bits calculation (NFC)
Browse files Browse the repository at this point in the history
Don't compute known bits of all GEP operands, if we already know
that we don't know anything.
  • Loading branch information
nikic committed May 2, 2020
1 parent b7e2358 commit 8148b11
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions llvm/lib/Analysis/ValueTracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,10 @@ static void computeKnownBitsFromOperator(const Operator *I,

gep_type_iterator GTI = gep_type_begin(I);
for (unsigned i = 1, e = I->getNumOperands(); i != e; ++i, ++GTI) {
// TrailZ can only become smaller, short-circuit if we hit zero.
if (TrailZ == 0)
break;

Value *Index = I->getOperand(i);
if (StructType *STy = GTI.getStructTypeOrNull()) {
// Handle struct member offset arithmetic.
Expand Down

0 comments on commit 8148b11

Please sign in to comment.