[PATCH] D141256: [DAGCombine]Don't check for Undef/Poison if the node is deleted
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 13 10:54:11 PST 2023
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG95414345d54e: [DAGCombiner] `visitFREEZE()`: gracefully handle node invalidation (authored by Naville, committed by lebedev.ri).
Changed prior to commit:
https://reviews.llvm.org/D141256?vs=487627&id=489073#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141256/new/
https://reviews.llvm.org/D141256
Files:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/pr59891-dagcombine-deleted-freeze.ll
Index: llvm/test/CodeGen/AArch64/pr59891-dagcombine-deleted-freeze.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/pr59891-dagcombine-deleted-freeze.ll
@@ -0,0 +1,18 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=aarch64 | FileCheck %s
+
+; Freezing operand of an operation that is being freezed
+; may invalidate the whole SDValue we were trying to originally freeze.
+define i8 @pr59891(i64 %0) {
+; CHECK-LABEL: pr59891:
+; CHECK: // %bb.0:
+; CHECK-NEXT: mov w0, wzr
+; CHECK-NEXT: ret
+ %2 = freeze i64 %0
+ %3 = trunc i64 %2 to i1
+ %4 = trunc i64 %0 to i1
+ %5 = xor i1 %3, %4
+ %6 = freeze i1 %5
+ %7 = zext i1 %6 to i8
+ ret i8 %7
+}
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -14384,6 +14384,10 @@
}
}
+ // The whole node may have been updated, so the value we were holding
+ // may no longer be valid. Re-fetch the operand we're `freeze`ing.
+ N0 = N->getOperand(0);
+
// Finally, recreate the node, it's operands were updated to use
// frozen operands, so we just need to use it's "original" operands.
SmallVector<SDValue> Ops(N0->op_begin(), N0->op_end());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141256.489073.patch
Type: text/x-patch
Size: 1420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230113/039a1b03/attachment.bin>
More information about the llvm-commits
mailing list