[llvm] fdc0d5f - [DAG] Do not call computeKnownBits from isKnownToBeAPowerOfTwo
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 27 03:06:04 PDT 2023
Author: Jay Foad
Date: 2023-04-27T11:05:56+01:00
New Revision: fdc0d5f3999a48ea01ce3d642af57ee2ad39a3e7
URL: https://github.com/llvm/llvm-project/commit/fdc0d5f3999a48ea01ce3d642af57ee2ad39a3e7
DIFF: https://github.com/llvm/llvm-project/commit/fdc0d5f3999a48ea01ce3d642af57ee2ad39a3e7.diff
LOG: [DAG] Do not call computeKnownBits from isKnownToBeAPowerOfTwo
The only way known bits could help identify a known power of two is if
it knows exactly which power of two it is, i.e. if it is a known
constant. But in that case the value should have been simplified to a
constant already. So save some compile time by not calling
computeKnownBits.
Differential Revision: https://reviews.llvm.org/D149325
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index bdbd2f899c8b4..3fff6e2f39cbf 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -4022,10 +4022,7 @@ bool SelectionDAG::isKnownToBeAPowerOfTwo(SDValue Val) const {
// More could be done here, though the above checks are enough
// to handle some common cases.
-
- // Fall back to computeKnownBits to catch other known cases.
- KnownBits Known = computeKnownBits(Val);
- return (Known.countMaxPopulation() == 1) && (Known.countMinPopulation() == 1);
+ return false;
}
unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, unsigned Depth) const {
More information about the llvm-commits
mailing list