[PATCH] D92446: [GlobalISel] Avoid asserting when SizeOp0 isn't an exact multiple of NarrowSize
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 1 13:20:27 PST 2021
nikic updated this revision to Diff 327260.
nikic retitled this revision from "Avoid asserting when SizeOp0 isn't an exact multiple of NarrowSize." to "[GlobalISel] Avoid asserting when SizeOp0 isn't an exact multiple of NarrowSize".
nikic added a comment.
Herald added a subscriber: rovka.
Add test case. As we're testing SDAG fallback here, I assumed that an IR test case is appropriate.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92446/new/
https://reviews.llvm.org/D92446
Files:
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
llvm/test/CodeGen/AArch64/pr48188.ll
Index: llvm/test/CodeGen/AArch64/pr48188.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/pr48188.ll
@@ -0,0 +1,27 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -O0 -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s
+
+; GlobalISel cannot legalize this phi, so we fall back to SDAG.
+define void @test() nounwind {
+; CHECK-LABEL: test:
+; CHECK: // %bb.0: // %entry
+; CHECK-NEXT: sub sp, sp, #16 // =16
+; CHECK-NEXT: mov x1, xzr
+; CHECK-NEXT: mov x0, x1
+; CHECK-NEXT: str x1, [sp] // 8-byte Folded Spill
+; CHECK-NEXT: str x0, [sp, #8] // 8-byte Folded Spill
+; CHECK-NEXT: b .LBB0_1
+; CHECK-NEXT: .LBB0_1: // %loop
+; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
+; CHECK-NEXT: ldr x0, [sp, #8] // 8-byte Folded Reload
+; CHECK-NEXT: ldr x1, [sp] // 8-byte Folded Reload
+; CHECK-NEXT: str x1, [sp] // 8-byte Folded Spill
+; CHECK-NEXT: str x0, [sp, #8] // 8-byte Folded Spill
+; CHECK-NEXT: b .LBB0_1
+entry:
+ br label %loop
+
+loop:
+ %p = phi i72 [ 0, %entry ], [ %p, %loop ]
+ br label %loop
+}
Index: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
===================================================================
--- llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -1006,6 +1006,11 @@
Observer.changedInstr(MI);
return Legalized;
case TargetOpcode::G_PHI: {
+ // FIXME: add support for when SizeOp0 isn't an exact multiple of
+ // NarrowSize.
+ if (SizeOp0 % NarrowSize != 0)
+ return UnableToLegalize;
+
unsigned NumParts = SizeOp0 / NarrowSize;
SmallVector<Register, 2> DstRegs(NumParts);
SmallVector<SmallVector<Register, 2>, 2> SrcRegs(MI.getNumOperands() / 2);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92446.327260.patch
Type: text/x-patch
Size: 1848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210301/8566af36/attachment-0001.bin>
More information about the llvm-commits
mailing list