From e4dc717585d5b891d187248352cbbc8d2438da96 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Fri, 23 Nov 2007 19:30:27 +0000 Subject: Ding dong, the DoesntAccessMemoryFns and OnlyReadsMemoryFns tables are dead! We get more, and more accurate, information from gcc via the readnone and readonly function attributes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44288 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/LICM/call_sink_const_function.ll | 21 +++++++++++---------- test/Transforms/LICM/call_sink_pure_function.ll | 20 +++++++++++--------- 2 files changed, 22 insertions(+), 19 deletions(-) (limited to 'test/Transforms/LICM') diff --git a/test/Transforms/LICM/call_sink_const_function.ll b/test/Transforms/LICM/call_sink_const_function.ll index a8a4b72d6d..f187e27335 100644 --- a/test/Transforms/LICM/call_sink_const_function.ll +++ b/test/Transforms/LICM/call_sink_const_function.ll @@ -1,16 +1,17 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -licm | llvm-dis | %prcontext sin 1 | grep Out: -declare double %sin(double) -declare void %foo() +; RUN: llvm-as < %s | opt -basicaa -licm | llvm-dis | %prcontext sin 1 | grep Out: -double %test(double %X) { - br label %Loop +declare double @sin(double) readnone + +declare void @foo() -Loop: - call void %foo() ;; Unknown effects! +define double @test(double %X) { + br label %Loop - %A = call double %sin(double %X) ;; Can still hoist/sink call - br bool true, label %Loop, label %Out +Loop: ; preds = %Loop, %0 + call void @foo( ) + %A = call double @sin( double %X ) readnone ; [#uses=1] + br i1 true, label %Loop, label %Out -Out: +Out: ; preds = %Loop ret double %A } diff --git a/test/Transforms/LICM/call_sink_pure_function.ll b/test/Transforms/LICM/call_sink_pure_function.ll index e5857a62a6..c0457a17fc 100644 --- a/test/Transforms/LICM/call_sink_pure_function.ll +++ b/test/Transforms/LICM/call_sink_pure_function.ll @@ -1,14 +1,16 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -licm | llvm-dis | %prcontext strlen 1 | grep Out: -declare int %strlen(sbyte*) -declare void %foo() +; RUN: llvm-as < %s | opt -basicaa -licm | llvm-dis | %prcontext strlen 1 | grep Out: -int %test(sbyte* %P) { +declare i32 @strlen(i8*) readonly + +declare void @foo() + +define i32 @test(i8* %P) { br label %Loop -Loop: - %A = call int %strlen(sbyte* %P) ;; Can hoist/sink call - br bool false, label %Loop, label %Out +Loop: ; preds = %Loop, %0 + %A = call i32 @strlen( i8* %P ) readonly ; [#uses=1] + br i1 false, label %Loop, label %Out -Out: - ret int %A +Out: ; preds = %Loop + ret i32 %A } -- cgit v1.2.3