[llvm] [RFC] TableGen-erate SDNode descriptions (PR #119709)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 08:49:54 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {undef deprecator}-->


:warning: undef deprecator found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git diff -U0 --pickaxe-regex -S '([^a-zA-Z0-9#_-]undef[^a-zA-Z0-9_-]|UndefValue::get)' 625ec7ec8983e040c440928bc1b35143a6362eab b90b16f69efc88b6c841b0470d3fdc9931fcf460 llvm/include/llvm/CodeGen/SDNodeInfo.h llvm/lib/CodeGen/SelectionDAG/SDNodeInfo.cpp llvm/lib/Target/AMDGPU/AMDGPUSelectionDAGInfo.cpp llvm/lib/Target/AMDGPU/AMDGPUSelectionDAGInfo.h llvm/lib/Target/ARC/ARCSelectionDAGInfo.cpp llvm/lib/Target/ARC/ARCSelectionDAGInfo.h llvm/lib/Target/AVR/AVRSelectionDAGInfo.cpp llvm/lib/Target/CSKY/CSKYSelectionDAGInfo.cpp llvm/lib/Target/CSKY/CSKYSelectionDAGInfo.h llvm/lib/Target/LoongArch/LoongArchSelectionDAGInfo.cpp llvm/lib/Target/LoongArch/LoongArchSelectionDAGInfo.h llvm/lib/Target/M68k/M68kSelectionDAGInfo.cpp llvm/lib/Target/M68k/M68kSelectionDAGInfo.h llvm/lib/Target/MSP430/MSP430SelectionDAGInfo.cpp llvm/lib/Target/MSP430/MSP430SelectionDAGInfo.h llvm/lib/Target/Mips/MipsSelectionDAGInfo.cpp llvm/lib/Target/Mips/MipsSelectionDAGInfo.h llvm/lib/Target/NVPTX/NVPTXSelectionDAGInfo.cpp llvm/lib/Target/NVPTX/NVPTXSelectionDAGInfo.h llvm/lib/Target/PowerPC/PPCSelectionDAGInfo.cpp llvm/lib/Target/PowerPC/PPCSelectionDAGInfo.h llvm/lib/Target/RISCV/RISCVSelectionDAGInfo.cpp llvm/lib/Target/RISCV/RISCVSelectionDAGInfo.h llvm/lib/Target/Sparc/SparcSelectionDAGInfo.cpp llvm/lib/Target/Sparc/SparcSelectionDAGInfo.h llvm/lib/Target/VE/VESelectionDAGInfo.cpp llvm/lib/Target/VE/VESelectionDAGInfo.h llvm/lib/Target/Xtensa/XtensaSelectionDAGInfo.cpp llvm/lib/Target/Xtensa/XtensaSelectionDAGInfo.h llvm/utils/TableGen/SDNodeInfoEmitter.cpp llvm/include/llvm/CodeGen/ISDOpcodes.h llvm/include/llvm/CodeGen/SelectionDAG.h llvm/include/llvm/CodeGen/SelectionDAGNodes.h llvm/include/llvm/CodeGen/SelectionDAGTargetInfo.h llvm/include/llvm/CodeGen/TargetLowering.h llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAGTargetInfo.cpp llvm/lib/Target/AArch64/AArch64ISelLowering.cpp llvm/lib/Target/AArch64/AArch64ISelLowering.h llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.h llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h llvm/lib/Target/AMDGPU/GCNSubtarget.cpp llvm/lib/Target/AMDGPU/GCNSubtarget.h llvm/lib/Target/AMDGPU/R600ISelLowering.cpp llvm/lib/Target/AMDGPU/R600Subtarget.cpp llvm/lib/Target/AMDGPU/R600Subtarget.h llvm/lib/Target/AMDGPU/SIISelLowering.cpp llvm/lib/Target/ARC/ARCISelDAGToDAG.cpp llvm/lib/Target/ARC/ARCISelLowering.cpp llvm/lib/Target/ARC/ARCISelLowering.h llvm/lib/Target/ARC/ARCSubtarget.cpp llvm/lib/Target/ARC/ARCSubtarget.h llvm/lib/Target/ARM/ARMISelLowering.cpp llvm/lib/Target/ARM/ARMISelLowering.h llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp llvm/lib/Target/ARM/ARMSelectionDAGInfo.h llvm/lib/Target/AVR/AVRISelLowering.cpp llvm/lib/Target/AVR/AVRISelLowering.h llvm/lib/Target/AVR/AVRSelectionDAGInfo.h llvm/lib/Target/BPF/BPFISelLowering.cpp llvm/lib/Target/BPF/BPFISelLowering.h llvm/lib/Target/BPF/BPFSelectionDAGInfo.cpp llvm/lib/Target/BPF/BPFSelectionDAGInfo.h llvm/lib/Target/CSKY/CSKYISelLowering.cpp llvm/lib/Target/CSKY/CSKYISelLowering.h llvm/lib/Target/CSKY/CSKYSubtarget.cpp llvm/lib/Target/CSKY/CSKYSubtarget.h llvm/lib/Target/Hexagon/HexagonISelLowering.cpp llvm/lib/Target/Hexagon/HexagonISelLowering.h llvm/lib/Target/Hexagon/HexagonSelectionDAGInfo.cpp llvm/lib/Target/Hexagon/HexagonSelectionDAGInfo.h llvm/lib/Target/Lanai/LanaiISelLowering.cpp llvm/lib/Target/Lanai/LanaiISelLowering.h llvm/lib/Target/Lanai/LanaiSelectionDAGInfo.cpp llvm/lib/Target/Lanai/LanaiSelectionDAGInfo.h llvm/lib/Target/LoongArch/LoongArchISelDAGToDAG.h llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp llvm/lib/Target/LoongArch/LoongArchISelLowering.h llvm/lib/Target/LoongArch/LoongArchSubtarget.cpp llvm/lib/Target/LoongArch/LoongArchSubtarget.h llvm/lib/Target/M68k/M68kISelDAGToDAG.cpp llvm/lib/Target/M68k/M68kISelLowering.cpp llvm/lib/Target/M68k/M68kISelLowering.h llvm/lib/Target/M68k/M68kSubtarget.cpp llvm/lib/Target/M68k/M68kSubtarget.h llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp llvm/lib/Target/MSP430/MSP430ISelLowering.cpp llvm/lib/Target/MSP430/MSP430ISelLowering.h llvm/lib/Target/MSP430/MSP430Subtarget.cpp llvm/lib/Target/MSP430/MSP430Subtarget.h llvm/lib/Target/Mips/MipsISelLowering.cpp llvm/lib/Target/Mips/MipsISelLowering.h llvm/lib/Target/Mips/MipsSubtarget.cpp llvm/lib/Target/Mips/MipsSubtarget.h llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.h llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp llvm/lib/Target/NVPTX/NVPTXISelLowering.h llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp llvm/lib/Target/NVPTX/NVPTXSubtarget.h llvm/lib/Target/PowerPC/PPCFastISel.cpp llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp llvm/lib/Target/PowerPC/PPCISelLowering.cpp llvm/lib/Target/PowerPC/PPCISelLowering.h llvm/lib/Target/PowerPC/PPCSubtarget.cpp llvm/lib/Target/PowerPC/PPCSubtarget.h llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h llvm/lib/Target/RISCV/RISCVISelLowering.cpp llvm/lib/Target/RISCV/RISCVISelLowering.h llvm/lib/Target/RISCV/RISCVSubtarget.cpp llvm/lib/Target/RISCV/RISCVSubtarget.h llvm/lib/Target/RISCV/RISCVTargetMachine.h llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp llvm/lib/Target/Sparc/SparcISelLowering.cpp llvm/lib/Target/Sparc/SparcISelLowering.h llvm/lib/Target/Sparc/SparcSubtarget.cpp llvm/lib/Target/Sparc/SparcSubtarget.h llvm/lib/Target/SystemZ/SystemZISelLowering.cpp llvm/lib/Target/SystemZ/SystemZISelLowering.h llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.h llvm/lib/Target/VE/VECustomDAG.cpp llvm/lib/Target/VE/VEISelDAGToDAG.cpp llvm/lib/Target/VE/VEISelLowering.cpp llvm/lib/Target/VE/VEISelLowering.h llvm/lib/Target/VE/VESubtarget.cpp llvm/lib/Target/VE/VESubtarget.h llvm/lib/Target/VE/VVPISelLowering.cpp llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h llvm/lib/Target/WebAssembly/WebAssemblySelectionDAGInfo.cpp llvm/lib/Target/WebAssembly/WebAssemblySelectionDAGInfo.h llvm/lib/Target/X86/X86ISelLowering.cpp llvm/lib/Target/X86/X86ISelLowering.h llvm/lib/Target/X86/X86ISelLoweringCall.cpp llvm/lib/Target/X86/X86SelectionDAGInfo.cpp llvm/lib/Target/X86/X86SelectionDAGInfo.h llvm/lib/Target/XCore/XCoreISelLowering.cpp llvm/lib/Target/XCore/XCoreISelLowering.h llvm/lib/Target/XCore/XCoreSelectionDAGInfo.cpp llvm/lib/Target/XCore/XCoreSelectionDAGInfo.h llvm/lib/Target/Xtensa/XtensaISelDAGToDAG.cpp llvm/lib/Target/Xtensa/XtensaISelLowering.cpp llvm/lib/Target/Xtensa/XtensaISelLowering.h llvm/lib/Target/Xtensa/XtensaSubtarget.cpp llvm/lib/Target/Xtensa/XtensaSubtarget.h llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ds.ordered.add.gfx11.ll llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ptr.buffer.atomic.fadd_rtn_errors.ll llvm/test/CodeGen/AMDGPU/sdag-print-divergence.ll llvm/utils/TableGen/Basic/SequenceToOffsetTable.h llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp llvm/utils/TableGen/Common/CodeGenDAGPatterns.h llvm/unittests/Target/AArch64/AArch64SelectionDAGTest.cpp
``````````

</details>


The following files introduce new uses of undef:
 - llvm/lib/Target/Hexagon/HexagonSelectionDAGInfo.h

[Undef](https://llvm.org/docs/LangRef.html#undefined-values) is now deprecated and should only be used in the rare cases where no replacement is possible. For example, a load of uninitialized memory yields `undef`. You should use `poison` values for placeholders instead.

In tests, avoid using `undef` and having tests that trigger undefined behavior. If you need an operand with some unimportant value, you can add a new argument to the function and use that instead.

For example, this is considered a bad practice:
```llvm
define void @fn() {
  ...
  br i1 undef, ...
}
```

Please use the following instead:
```llvm
define void @fn(i1 %cond) {
  ...
  br i1 %cond, ...
}
```

Please refer to the [Undefined Behavior Manual](https://llvm.org/docs/UndefinedBehavior.html) for more information.



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


More information about the llvm-commits mailing list