[llvm] [WebAssembly,llvm] Add llvm.wasm.ref.test.func intrinsic, option 2 (PR #147486)
Hood Chatham via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 8 02:25:36 PDT 2025
================
@@ -402,7 +402,12 @@ void InstrEmitter::AddOperand(MachineInstrBuilder &MIB, SDValue Op,
AddRegisterOperand(MIB, Op, IIOpNum, II, VRBaseMap,
IsDebug, IsClone, IsCloned);
} else if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) {
- MIB.addImm(C->getSExtValue());
+ if (C->getOpcode() == ISD::TargetConstantAP) {
+ MIB.addCImm(
+ ConstantInt::get(MF->getFunction().getContext(), C->getAPIntValue()));
+ } else {
+ MIB.addImm(C->getSExtValue());
+ }
----------------
hoodmane wrote:
Surely if I just changed this line to
```patch
- MIB.addImm(C->getSExtValue());
+ MIB.addCImm(
+ ConstantInt::get(MF->getFunction().getContext(), C->getAPIntValue()));
```
it would break a bunch of things since all TargetConstants would change from lowering to CImm instead of Imm? I think that if there are both Imm and CImm at the MachineInstr layer and they are handled differently, there should be distinct SD nodes that lower to both of them. WDYT?
https://github.com/llvm/llvm-project/pull/147486
More information about the llvm-commits
mailing list