[llvm] [InstCombine] Fold `(shl ShVal, (X + 1) & (Width-1)) | (lshr ShVal, (X & Width-1) ^ (Width-1))` --> `fshl(ShVal, ShVal, X+1)` (PR #214035)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 15 08:45:58 PDT 2026


================
@@ -3013,6 +3013,17 @@ InstCombinerImpl::convertOrOfShiftsToFunnelShift(Instruction &Or) {
           match(R, m_And(m_Neg(m_Specific(X)), m_SpecificInt(Mask))))
         return X;
 
+      // (shl ShVal,(X+1) & (Width-1)) | (lshr ShVal,((X & (Width-1)) ^
+      // (Width-1)))
+      {
+        Value *ShAmt = nullptr;
----------------
dtcxzyw wrote:

`ShAmt` has a specific meaning (RHS of shift operators). Use `XPlusOne` instead.


https://github.com/llvm/llvm-project/pull/214035


More information about the llvm-commits mailing list