[llvm] eae90fd - [test] exercise breakLoopBackedge with a switch latch cond
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 27 10:11:22 PDT 2021
Author: Philip Reames
Date: 2021-08-27T10:11:13-07:00
New Revision: eae90fdc75011f5aee75f33a86d4f4dec93984a3
URL: https://github.com/llvm/llvm-project/commit/eae90fdc75011f5aee75f33a86d4f4dec93984a3
DIFF: https://github.com/llvm/llvm-project/commit/eae90fdc75011f5aee75f33a86d4f4dec93984a3.diff
LOG: [test] exercise breakLoopBackedge with a switch latch cond
This was reduced from a test case which triggered a revert to my recent change to same function. It turns out we didn't have *any* coverage of the non-branch latch and my patch was blatantly broken.
Added:
llvm/test/Transforms/LoopDeletion/switch.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/LoopDeletion/switch.ll b/llvm/test/Transforms/LoopDeletion/switch.ll
new file mode 100644
index 0000000000000..571e31dddfba1
--- /dev/null
+++ b/llvm/test/Transforms/LoopDeletion/switch.ll
@@ -0,0 +1,43 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -loop-deletion -verify-loop-info -S | FileCheck %s
+
+target triple = "x86_64-unknown-linux-gnu"
+
+ at G = external global i32
+
+define void @func_1() {
+; CHECK-LABEL: @func_1(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[LBL_2368:%.*]]
+; CHECK: lbl_2368:
+; CHECK-NEXT: [[CMP289:%.*]] = icmp slt i32 undef, -5
+; CHECK-NEXT: br i1 [[CMP289]], label [[CLEANUP967:%.*]], label [[UNREACHABLE:%.*]]
+; CHECK: cleanup967:
+; CHECK-NEXT: switch i32 undef, label [[CLEANUP1169:%.*]] [
+; CHECK-NEXT: i32 20, label [[CLEANUP967_LBL_2368_CRIT_EDGE:%.*]]
+; CHECK-NEXT: ]
+; CHECK: cleanup967.lbl_2368_crit_edge:
+; CHECK-NEXT: unreachable
+; CHECK: cleanup1169:
+; CHECK-NEXT: ret void
+; CHECK: unreachable:
+; CHECK-NEXT: unreachable
+;
+entry:
+ br label %lbl_2368
+
+lbl_2368:
+ %cmp289 = icmp slt i32 undef, -5
+ br i1 %cmp289, label %cleanup967, label %unreachable
+
+cleanup967:
+ switch i32 undef, label %cleanup1169 [
+ i32 20, label %lbl_2368
+ ]
+
+cleanup1169:
+ ret void
+
+unreachable:
+ unreachable
+}
More information about the llvm-commits
mailing list