[PATCH] D114950: [RISCV] Promote large integers to constant pool

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 13 11:10:23 PST 2021


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp:130
+                                         const MVT VT,
+                                         ConstantSDNode *ConstNode,
+                                         const RISCVSubtarget &Subtarget) {
----------------
We should probably pass `int64_t Imm` here and call ConstantInt::get(EVT(VT).getTypeForEVT(CurDAG->getContext(), Imm)` to get the ConstantInt* that getConstantPool needs. That would solve the problems in my other comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp:805
     // Create (mulhu (slli X, lzcnt(C2)), C1 << (XLen - lzcnt(C2))).
-    SDNode *Imm = selectImm(CurDAG, DL, ShiftedC1, *Subtarget);
+    SDNode *Imm = selectImm(CurDAG, DL, VT, ShiftedC1, N1C, *Subtarget);
     SDNode *SLLI =
----------------
N1C does not contain the same constant as ShiftedC1.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114950/new/

https://reviews.llvm.org/D114950



More information about the llvm-commits mailing list