[llvm] [TLI] Add support for inferring attr `cold` on `exit`/`abort` (PR #101003)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 29 05:51:25 PDT 2024
================
@@ -0,0 +1,42 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt < %s -passes=instcombine -S | FileCheck %s
+
+declare void @exit(i32)
+declare void @_Exit(i32)
+
+define void @call_exit_0() {
+; CHECK-LABEL: define void @call_exit_0() {
+; CHECK-NEXT: call void @exit(i32 0)
+; CHECK-NEXT: ret void
+;
+ call void @exit(i32 0)
+ ret void
+}
+
+define void @call_exit_1() {
+; CHECK-LABEL: define void @call_exit_1() {
+; CHECK-NEXT: call void @exit(i32 1) #[[ATTR0:[0-9]+]]
+; CHECK-NEXT: ret void
+;
+ call void @exit(i32 1)
+ ret void
+}
+
+define void @call__Exit_m1() {
+; CHECK-LABEL: define void @call__Exit_m1() {
+; CHECK-NEXT: call void @_Exit(i32 -1) #[[ATTR0]]
+; CHECK-NEXT: ret void
+;
+ call void @_Exit(i32 -1)
+ ret void
+}
+
+define void @call__Exit_N(i32 %N) {
+; CHECK-LABEL: define void @call__Exit_N(
+; CHECK-SAME: i32 [[N:%.*]]) {
+; CHECK-NEXT: call void @_Exit(i32 [[N]])
+; CHECK-NEXT: ret void
+;
+ call void @_Exit(i32 %N)
+ ret void
+}
----------------
nikic wrote:
You need to use `--check-globals all` to generate this, not edit it in by hand.
https://github.com/llvm/llvm-project/pull/101003
More information about the llvm-commits
mailing list