[llvm] Introducing a new ISD::POISON SDNode to represent the poison value in the IR. (PR #125883)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 3 12:58:47 PDT 2025
================
@@ -5,9 +5,10 @@ define dso_local void @foo() #1 {
; CHECK-LABEL: foo:
; CHECK: # %bb.0: # %newFuncRoot
; CHECK-NEXT: vpmovzxbd {{.*#+}} ymm0 = mem[0],zero,zero,zero,mem[1],zero,zero,zero,mem[2],zero,zero,zero,mem[3],zero,zero,zero,mem[4],zero,zero,zero,mem[5],zero,zero,zero,mem[6],zero,zero,zero,mem[7],zero,zero,zero
-; CHECK-NEXT: vpbroadcastd {{.*#+}} ymm1 = [64,64,64,64,64,64,64,64]
-; CHECK-NEXT: vpdpwssd {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %ymm0, %ymm1
-; CHECK-NEXT: vpsrld $7, %ymm1, %ymm0
+; CHECK-NEXT: vpbroadcastd {{.*#+}} ymm1 = [18,0,18,0,18,0,18,0,18,0,18,0,18,0,18,0]
+; CHECK-NEXT: vpmaddwd %ymm1, %ymm0, %ymm0
+; CHECK-NEXT: vpaddd {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %ymm0, %ymm0
----------------
topperc wrote:
For referencce, this quick patch works
```
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 25ac0b956872..c54c3bedc543 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -7604,6 +7604,13 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
}
}
+ if (N2.getOpcode() == ISD::POISON) {
+ switch (Opcode) {
+ case ISD::ADD:
+ return getPOISON(VT);
+ }
+ }
+
// Fold a bunch of operators when the RHS is undef.
if (N2.isUndef()) {
switch (Opcode) {
```
https://github.com/llvm/llvm-project/pull/125883
More information about the llvm-commits
mailing list