[llvm] e529c0a - [TargetLowering] Use ComputeMaxSignificantBits instead of ComputeNumSignBits in expandMUL_LOHI. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 4 22:37:10 PDT 2022
Author: Craig Topper
Date: 2022-09-04T22:35:16-07:00
New Revision: e529c0a2a03fb4eb0ddffafe0ddc7a02059f74cc
URL: https://github.com/llvm/llvm-project/commit/e529c0a2a03fb4eb0ddffafe0ddc7a02059f74cc
DIFF: https://github.com/llvm/llvm-project/commit/e529c0a2a03fb4eb0ddffafe0ddc7a02059f74cc.diff
LOG: [TargetLowering] Use ComputeMaxSignificantBits instead of ComputeNumSignBits in expandMUL_LOHI. NFC
The way ComputeNumSignBits was being used was only correct if
OuterBitSize is exactly 2x InnerBitSize. Which is always true,
but not obviously so. Comparing ComputeMaxSignificantBits to
InnerBitSize feels more correct.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index da15c85898d5..d383adf6c468 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -7031,8 +7031,8 @@ bool TargetLowering::expandMUL_LOHI(unsigned Opcode, EVT VT, const SDLoc &dl,
}
if (!VT.isVector() && Opcode == ISD::MUL &&
- DAG.ComputeNumSignBits(LHS) > InnerBitSize &&
- DAG.ComputeNumSignBits(RHS) > InnerBitSize) {
+ DAG.ComputeMaxSignificantBits(LHS) <= InnerBitSize &&
+ DAG.ComputeMaxSignificantBits(RHS) <= InnerBitSize) {
// The input values are both sign-extended.
// TODO non-MUL case?
if (MakeMUL_LOHI(LL, RL, Lo, Hi, true)) {
More information about the llvm-commits
mailing list