[llvm] Introducing a new ISD::POISON SDNode to represent the poison value in the IR. (PR #125883)

Amy Kwan via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 26 10:32:57 PDT 2025


================
@@ -977,6 +977,19 @@ void SelectionDAGLegalize::LegalizeOp(SDNode *Node) {
   TargetLowering::LegalizeAction Action = TargetLowering::Legal;
   bool SimpleFinishLegalizing = true;
   switch (Node->getOpcode()) {
+  // TODO: Currently, POISON is being lowered to UNDEF here. However, there is
+  // an open concern that this transformation may not be ideal, as targets
+  // should ideally handle POISON directly. Changing this behavior would require
+  // adding support for POISON in TableGen, which is a large change.
+  // Additionally, many existing test cases rely on the current behavior (e.g.,
+  // llvm/test/CodeGen/PowerPC/vec_shuffle.ll). A broader discussion and
+  // incremental changes might be needed to properly
+  //  support POISON without breaking existing targets and tests.
----------------
amy-kwan wrote:

```suggestion
  // support POISON without breaking existing targets and tests.
```

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


More information about the llvm-commits mailing list