about summary refs log tree commit diff
path: root/src/test/ui/codegen
diff options
context:
space:
mode:
authorErik Desjardins <erikdesjardins@users.noreply.github.com>2021-08-15 14:26:14 -0400
committerErik Desjardins <erikdesjardins@users.noreply.github.com>2021-08-15 23:44:34 -0400
commitb865a761cbc2cfdffbcb1f60607da73172bc9772 (patch)
treed4f7b1c30e49b6e2f0b15c15372f4af44705e723 /src/test/ui/codegen
parent8e11199a153218c13a419df37a9bb675181cccb7 (diff)
downloadrust-b865a761cbc2cfdffbcb1f60607da73172bc9772.tar.gz
rust-b865a761cbc2cfdffbcb1f60607da73172bc9772.zip
add regression test
Diffstat (limited to 'src/test/ui/codegen')
-rw-r--r--src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs b/src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs
new file mode 100644
index 00000000000..1a6aadc662b
--- /dev/null
+++ b/src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs
@@ -0,0 +1,25 @@
+// build-pass
+// compile-flags: -Copt-level=0
+
+// Regression test for #88043: LLVM crash when the RemoveZsts mir-opt pass is enabled.
+// We should not see the error:
+// `Basic Block in function '_ZN4main10take_until17h0067b8a660429bc9E' does not have terminator!`
+
+fn bump() -> Option<usize> {
+    unreachable!()
+}
+
+fn take_until(terminate: impl Fn() -> bool) {
+    loop {
+        if terminate() {
+            return;
+        } else {
+            bump();
+        }
+    }
+}
+
+// CHECK-LABEL: @main
+fn main() {
+    take_until(|| true);
+}