[llvm] [RISCV] Combine (ADDI (ADDI X, C1), C2) -> (ADDI X, C1+C2) (PR #157416)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 8 11:19:34 PDT 2025


================
@@ -4019,7 +4019,7 @@ void SelectionDAGBuilder::visitBitCast(const User &I) {
   // constant integer as an opaque constant.
   else if(ConstantInt *C = dyn_cast<ConstantInt>(I.getOperand(0)))
     setValue(&I, DAG.getConstant(C->getValue(), dl, DestVT, /*isTarget=*/false,
-                                 /*isOpaque*/true));
+                                 /*isOpaque*/false));
----------------
topperc wrote:

The ConstantHoisting pass adds a NOP bitcast to mark the constants that have been hoisted. bitcasts of constants normally should be optimized out before the codegen pipeline starts. So the only cases that SelectionDAG should see come from the ConstantHoisting pass.

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


More information about the llvm-commits mailing list