[llvm] Add command line option --no-trap-after-noreturn (PR #67051)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 13:02:20 PDT 2023


================
@@ -1,8 +1,25 @@
-; RUN: llc -mtriple=thumbv7 -trap-unreachable < %s | FileCheck %s
-; CHECK: .inst.n 0xdefe
+; RUN: llc -mtriple=thumbv7 -trap-unreachable < %s | FileCheck %s --check-prefixes CHECK,TRAP_UNREACHABLE
+; RUN: llc -mtriple=thumbv7 -trap-unreachable -no-trap-after-noreturn < %s | FileCheck %s --check-prefixes CHECK,NTANR
 
-define void @test() #0 {
+define void @test_trap_unreachable() #0 {
+; CHECK-LABEL: test_trap_unreachable:
+; CHECK:       @ %bb.0:
+; CHECK-NEXT:    .inst.n 0xdefe
   unreachable
 }
 
 attributes #0 = { nounwind }
+
+declare void @no_return() noreturn
+
+define void @test_ntanr() {
+; CHECK-LABEL:           test_ntanr:
+; CHECK:                 @ %bb.0:
+; CHECK-NEXT:              push {r7, lr}
+; CHECK-NEXT:              bl no_return
+; TRAP_UNREACHABLE-NEXT:   .inst.n 0xdefe
+; NTANR-NOT:               .inst.n 0xdefe
+;
+  call void @no_return()
+  unreachable
----------------
nikic wrote:

I'd suggest adding another block to this function with a non-noreturn call.

https://github.com/llvm/llvm-project/pull/67051


More information about the llvm-commits mailing list