[llvm] 3c1b9f2 - [WebAssembly][NFC] use getOneBitSet instead init + shifting for APint (#188552)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 30 07:24:37 PDT 2026
Author: Max Graey
Date: 2026-03-30T16:24:31+02:00
New Revision: 3c1b9f278dae46d150e7b5be96dd0575d6901463
URL: https://github.com/llvm/llvm-project/commit/3c1b9f278dae46d150e7b5be96dd0575d6901463
DIFF: https://github.com/llvm/llvm-project/commit/3c1b9f278dae46d150e7b5be96dd0575d6901463.diff
LOG: [WebAssembly][NFC] use getOneBitSet instead init + shifting for APint (#188552)
This is valid due to `ShiftAmt < BitWidth` which is ensured by early
`ShiftAmt.uge(MaxValidShift)` testing.
Added:
Modified:
llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
index 913a5bb22cb41..a0c5e2f5d2639 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -3808,7 +3808,7 @@ static SDValue performShiftCombine(SDNode *N,
if (ShiftAmt.uge(MaxValidShift))
return SDValue();
- APInt MulAmt = APInt(BitWidth, 1).shl(ShiftAmt);
+ APInt MulAmt = APInt::getOneBitSet(BitWidth, ShiftAmt.getZExtValue());
MulConsts.push_back(DAG.getConstant(MulAmt, DL, FromVT.getScalarType(),
/*isTarget=*/false, /*isOpaque=*/true));
}
More information about the llvm-commits
mailing list