[llvm] [Analysis] Attribute Range should not prevent tail call optimization (PR #91122)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Tue May 7 09:50:18 PDT 2024
================
@@ -0,0 +1,33 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
+; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s
+
+define range(i32 0, 2) i32 @foo(ptr %this, ...) {
+; CHECK-LABEL: foo:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: movzbl 0, %eax
+; CHECK-NEXT: retq
+entry:
+ %call = load volatile i1, ptr null, align 1
+ %spec.select = zext i1 %call to i32
+ ret i32 %spec.select
+}
+
+define range(i32 0, 2) i32 @bar(ptr %this, ...) {
+; CHECK-LABEL: bar:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: xorl %edi, %edi
+; CHECK-NEXT: jmp foo at PLT # TAILCALL
+entry:
+ %4 = musttail call i32 (ptr, ...) @foo(ptr null, ...)
+ ret i32 %4
+}
+
+declare i64 @llvm.llround.f32(float) nounwind readnone
+define range(i64 0, 8) i64 @testmsxs(float %x) {
+; CHECK-LABEL: testmsxs:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: jmp llroundf at PLT # TAILCALL
+ entry:
+ %0 = tail call i64 @llvm.llround.f32(float %x)
+ ret i64 %0
+}
----------------
andjo403 wrote:
shall there also be a test where the call have a range attribute?
https://github.com/llvm/llvm-project/pull/91122
More information about the llvm-commits
mailing list