[llvm] [DAG] Convert select of constants to arithmetic operations (PR #198951)

dong jianqiang via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 14 02:03:35 PDT 2026


================
@@ -796,8 +796,9 @@ define i32 @diff_shl_addi(i32 signext %x) {
 ;
 ; RV32ZICOND-LABEL: diff_shl_addi:
 ; RV32ZICOND:       # %bb.0:
+; RV32ZICOND-NEXT:    lui a1, 4
 ; RV32ZICOND-NEXT:    srli a0, a0, 31
-; RV32ZICOND-NEXT:    slli a0, a0, 14
+; RV32ZICOND-NEXT:    czero.eqz a0, a1, a0
----------------
dongjianqiang2 wrote:

Thanks, you're right. The computeKnownBits guard was too loose and caught (srli a, XLen-1) too. Tightening it to AssertZext-of-i1 (the actual case where select lowering produces compressible addi -1; andi Pow2), Posting an updated patch.

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


More information about the llvm-commits mailing list