1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/test/Transforms/LICM/strlen.ll
Xin Tong 6a56ac682f Add argmononly attribute to strlen and wcslen, i.e. they only read memory (string) passed to them.
Summary:
This allows strlen to be moved out of the loop in case its argument is
not modified in the loop in LICM.

Reviewers: hfinkel, davide, sanjoy, dberlin

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D34323

llvm-svn: 305641
2017-06-18 03:10:26 +00:00

20 lines
414 B
LLVM

; RUN: opt -S -inferattrs -basicaa -licm < %s | FileCheck %s
define void @test(i64* noalias %loc, i8* noalias %a) {
; CHECK-LABEL: @test
; CHECK: @strlen
; CHECK-LABEL: loop:
br label %loop
loop:
%res = call i64 @strlen(i8* %a)
store i64 %res, i64* %loc
br label %loop
}
; CHECK: declare i64 @strlen(i8* nocapture) #0
; CHECK: attributes #0 = { argmemonly nounwind readonly }
declare i64 @strlen(i8*)