[all-commits] [llvm/llvm-project] a181b4: [llvm][NFC] Use SDValue::getConstantOperandAPInt(i...

Alex Bradbury via All-commits all-commits at lists.llvm.org
Tue Jan 2 06:47:13 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a181b425659a22c5535d2513f7dd7c7cf14e2d69
      https://github.com/llvm/llvm-project/commit/a181b425659a22c5535d2513f7dd7c7cf14e2d69
  Author: Alex Bradbury <asb at igalia.com>
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
    M llvm/lib/Target/ARM/ARMISelLowering.cpp
    M llvm/lib/Target/Mips/MipsISelDAGToDAG.cpp
    M llvm/lib/Target/Mips/MipsSEISelLowering.cpp
    M llvm/lib/Target/X86/X86ISelDAGToDAG.cpp

  Log Message:
  -----------
  [llvm][NFC] Use SDValue::getConstantOperandAPInt(i) where possible

The helper function allows examples like
`cast<ConstantSDNode>(Op.getOperand(0))->getAPIntValue();` to be changed
to `Op.getConstantOperandAPInt(0);`.

See #76708 for further context. Although there are far fewer
opportunities for replacement, I used a similar git grep and sed combo
as before, given I already had it to hand:

`git grep -l "cast<ConstantSDNode>\(.*->getOperand\(.*\)\)->getAPIntValue\(\)" | xargs sed -E -i 's/cast<ConstantSDNode>\((.*)->getOperand\((.*)\)\)->getAPIntValue\(\)/\1->getConstantOperandAPInt(\2)/'`
and
`git grep -l
"cast<ConstantSDNode>\(.*\.getOperand\(.*\)\)->getAPIntValue\(\)" |
xargs sed -E -i
's/cast<ConstantSDNode>\((.*)\.getOperand\((.*)\)\)->getAPIntValue\(\)/\1.getConstantOperandAPInt(\2)/'`




More information about the All-commits mailing list