[llvm] [ARM][Thumb2] Mark BTI-clearing instructions as scheduling region boundaries (PR #79173)

Anatoly Trosinenko via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 07:32:48 PST 2024


================
@@ -0,0 +1,124 @@
+# RUN: llc -o - -run-pass=machine-scheduler -misched=shuffle %s | FileCheck %s
+# RUN: llc -o - -run-pass=postmisched %s | FileCheck %s
+
+--- |
+  target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
+  target triple = "thumbv8.1m.main-arm-none-eabi"
+
+  define i32 @foo_bti(i32 %a) #1 {
+  entry:
+    %add = add nsw i32 %a, 1
+    ret i32 %add
+  }
+
+  define i32 @foo_pacbti(i32 %a) #1 {
+  entry:
+    %add = add nsw i32 %a, 1
+    ret i32 %add
+  }
+
+  define i32 @foo_setjmp() #0 {
+  entry:
+    %buf = alloca [20 x i64], align 8
+    %call = call i32 @setjmp(ptr noundef nonnull %buf) #4
+    %tobool.not = icmp eq i32 %call, 0
+    br i1 %tobool.not, label %if.else, label %if.then
+
+  if.then:                                          ; preds = %entry
+    call void @longjmp(ptr noundef nonnull %buf, i32 noundef 1) #5
+    unreachable
+
+  if.else:                                          ; preds = %entry
+    ret i32 0
+  }
+
+  declare i32 @setjmp(ptr noundef) #2
+  declare void @longjmp(ptr noundef, i32 noundef) #3
+
+  attributes #0 = { "frame-pointer"="all" "target-cpu"="cortex-m55" "target-features"="+armv8.1-m.main" }
+  attributes #1 = { "frame-pointer"="all" "target-cpu"="cortex-m55" "target-features"="+armv8.1-m.main" }
----------------
atrosinenko wrote:

`#0` and `#1` are the same after simplification.

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


More information about the llvm-commits mailing list