[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.
This commit is contained in:
Nikita Popov 2020-05-02 11:47:04 +02:00
parent b7e2358220
commit 8148b11647
1 changed files with 4 additions and 0 deletions

View File

@ -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.