[llvm] [Analysis] Attribute Range should not prevent tail call optimization (PR #91122)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Sun May 5 07:13:33 PDT 2024
================
@@ -0,0 +1,23 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
+; RUN: opt -passes=ipsccp -S -mtriple=x86_64-linux < %s | llc -mtriple=x86_64-linux | FileCheck %s
+
+define 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 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, ...)
----------------
phoebewang wrote:
Not sure if there's other issues, AFAIK, one thing special to VA function CC according to psABI is we need to set `%al` to indicate the preserve of XMM registers. The `%al` may need special handing here.
https://github.com/llvm/llvm-project/pull/91122
More information about the llvm-commits
mailing list