0
0
mirror of https://github.com/llvm/llvm-project.git synced 2025-04-27 07:26:07 +00:00
Yingwei Zheng 76e07d8ba5
[LibCall] Infer nocallback for libcalls ()
This patch adds `nocallback` attributes for string/math libcalls. It
allows FuncAttributor to infer `norecurse` more precisely and encourages
more aggressive global optimization.
2025-04-12 15:11:54 +08:00

20 lines
480 B
LLVM

; RUN: opt -S -passes='inferattrs,function(loop-mssa(licm))' < %s | FileCheck %s
define void @test(ptr noalias %loc, ptr noalias %a) {
; CHECK-LABEL: @test
; CHECK: @strlen
; CHECK-LABEL: loop:
br label %loop
loop:
%res = call i64 @strlen(ptr %a)
store i64 %res, ptr %loc
br label %loop
}
; CHECK: declare i64 @strlen(ptr captures(none)) #0
; CHECK: attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: read) }
declare i64 @strlen(ptr)