[ValueTracking][NFC] Use Log2(Align) instead of countTrailingZeroes
authorAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Tue, 27 Oct 2020 09:56:19 +0000 (09:56 +0000)
committerAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Tue, 27 Oct 2020 12:16:45 +0000 (12:16 +0000)
The latter can probably be optimized to the same final code, but this might
help -O0 builds.

llvm/lib/Analysis/ValueTracking.cpp

index dc252a2..05eb2fc 100644 (file)
@@ -2003,7 +2003,7 @@ void computeKnownBits(const Value *V, const APInt &DemandedElts,
   // Aligned pointers have trailing zeros - refine Known.Zero set
   if (isa<PointerType>(V->getType())) {
     Align Alignment = V->getPointerAlignment(Q.DL);
-    Known.Zero.setLowBits(countTrailingZeros(Alignment.value()));
+    Known.Zero.setLowBits(Log2(Alignment));
   }
 
   // computeKnownBitsFromAssume strictly refines Known.