[PATCH] D120150: Constant folding of llvm.amdgcn.trig.preop

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 08:41:02 PDT 2022


foad added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp:1021
+    Value *Segment = II.getArgOperand(1);
+    const ConstantFP *Csrc = dyn_cast<ConstantFP>(Src);
+    const ConstantInt *Cseg = dyn_cast<ConstantInt>(Segment);
----------------
Capitalizing the names like CSrc, CSeg, FSrc, NumBits etc is more common.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp:1029
+
+    const APInt &SegVal = Cseg->getUniqueInteger();
+    bool Ovflow;
----------------
Just use `->getValue`. And in general I think you should convert CSrc and CSeg to plain uint32_t / uint64_t as soon as possible. You have lots of uses of APInt below where it really is not necessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120150



More information about the llvm-commits mailing list