[llvm] d323c8f - [ValueTracking][NFC] Use Log2(Align) instead of countTrailingZeroes
Alex Richardson via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 27 05:17:46 PDT 2020
Author: Alex Richardson
Date: 2020-10-27T12:16:45Z
New Revision: d323c8f791ac1160813508f1742f845444b6459a
URL: https://github.com/llvm/llvm-project/commit/d323c8f791ac1160813508f1742f845444b6459a
DIFF: https://github.com/llvm/llvm-project/commit/d323c8f791ac1160813508f1742f845444b6459a.diff
LOG: [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.
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index dc252a281c4d..05eb2fc48270 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<PointerType>(V->getType())) {
Align Alignment = V->getPointerAlignment(Q.DL);
- Known.Zero.setLowBits(countTrailingZeros(Alignment.value()));
+ Known.Zero.setLowBits(Log2(Alignment));
}
// computeKnownBitsFromAssume strictly refines Known.
More information about the llvm-commits
mailing list