From d323c8f791ac1160813508f1742f845444b6459a Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Tue, 27 Oct 2020 09:56:19 +0000 Subject: [PATCH] [ValueTracking][NFC] Use Log2(Align) instead of countTrailingZeroes The latter can probably be optimized to the same final code, but this might help -O0 builds. --- llvm/lib/Analysis/ValueTracking.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index dc252a2..05eb2fc4 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -2003,7 +2003,7 @@ void computeKnownBits(const Value *V, const APInt &DemandedElts, // Aligned pointers have trailing zeros - refine Known.Zero set if (isa(V->getType())) { Align Alignment = V->getPointerAlignment(Q.DL); - Known.Zero.setLowBits(countTrailingZeros(Alignment.value())); + Known.Zero.setLowBits(Log2(Alignment)); } // computeKnownBitsFromAssume strictly refines Known. -- 2.7.4