[llvm-branch-commits] [llvm] 076ceb7 - [DAGCombiner] Replace LegalOperations check in visitSIGN_EXTEND with LegalTypes.
Tobias Hieta via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Mar 5 23:21:48 PST 2023
Author: Craig Topper
Date: 2023-03-06T08:21:19+01:00
New Revision: 076ceb7acede727c49a647e7d6e3d720f1fb8df0
URL: https://github.com/llvm/llvm-project/commit/076ceb7acede727c49a647e7d6e3d720f1fb8df0
DIFF: https://github.com/llvm/llvm-project/commit/076ceb7acede727c49a647e7d6e3d720f1fb8df0.diff
LOG: [DAGCombiner] Replace LegalOperations check in visitSIGN_EXTEND with LegalTypes.
This is guarding a check for isTypeLegal so it should check is
LegalTypes.
Fixes PR61111.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D145139
(cherry picked from commit c546f13f1f43e34a6a39ac70d3cf70adab4d05f4)
Added:
llvm/test/CodeGen/AArch64/pr61111.ll
Modified:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 355a793ead482..eed3d820c1204 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -12454,7 +12454,8 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
if (N0.getOpcode() == ISD::SIGN_EXTEND_INREG) {
SDValue N00 = N0.getOperand(0);
EVT ExtVT = cast<VTSDNode>(N0->getOperand(1))->getVT();
- if (N00.getOpcode() == ISD::TRUNCATE && (!LegalOperations || TLI.isTypeLegal(ExtVT))) {
+ if (N00.getOpcode() == ISD::TRUNCATE &&
+ (!LegalTypes || TLI.isTypeLegal(ExtVT))) {
SDValue T = DAG.getNode(ISD::TRUNCATE, DL, ExtVT, N00.getOperand(0));
return DAG.getNode(ISD::SIGN_EXTEND, DL, VT, T);
}
diff --git a/llvm/test/CodeGen/AArch64/pr61111.ll b/llvm/test/CodeGen/AArch64/pr61111.ll
new file mode 100644
index 0000000000000..d2c72921a9229
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/pr61111.ll
@@ -0,0 +1,25 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=aarch64-linux-gnu | FileCheck %s
+
+define i62 @f(i1 %0) {
+; CHECK-LABEL: f:
+; CHECK: // %bb.0:
+; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
+; CHECK-NEXT: and x8, x0, #0x1
+; CHECK-NEXT: sub x8, x8, #1
+; CHECK-NEXT: tst x8, #0x3fffffffffffffff
+; CHECK-NEXT: cset w0, ne
+; CHECK-NEXT: ret
+ %2 = zext i1 %0 to i59
+ %3 = call { i59, i1 } @llvm.umul.with.overflow.i59(i59 %2, i59 -1)
+ %4 = extractvalue { i59, i1 } %3, 0
+ %5 = trunc i59 %4 to i21
+ %6 = trunc i59 %4 to i21
+ %7 = ashr i21 %5, %6
+ %8 = sext i21 %7 to i62
+ %9 = icmp ugt i62 -1, %8
+ %10 = zext i1 %9 to i62
+ ret i62 %10
+}
+
+declare { i59, i1 } @llvm.umul.with.overflow.i59(i59, i59)
More information about the llvm-branch-commits
mailing list