llvm-6502/test/Analysis/BasicAA/pure-const-dce.ll
Bill Wendling 351b7a10e2 Use references to attribute groups on the call/invoke instructions.
Listing all of the attributes for the callee of a call/invoke instruction is way
too much and makes the IR unreadable. Use references to attributes instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175877 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22 09:09:42 +00:00

55 lines
2.0 KiB
LLVM

; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
@g = global i32 0
; CHECK: @test
; CHECK: entry
; CHECK: %tmp0 = call i32 @TestConst(i32 5) [[READNONE:#[0-9]+]]
; CHECK-NEXT: %tmp1 = call i32 @TestPure(i32 6) [[READONLY:#[0-9]+]]
; CHECK-NEXT: %tmp2 = call i32 @TestNone(i32 7)
; CHECK-NEXT: store i32 1, i32* @g
; CHECK-NEXT: %tmp5 = call i32 @TestPure(i32 6) [[READONLY]]
; CHECK-NEXT: %tmp7 = call i32 @TestNone(i32 7)
; CHECK-NEXT: %tmp8 = call i32 @TestNone(i32 7)
; CHECK-NEXT: %sum0 = add i32 %tmp0, %tmp1
; CHECK-NEXT: %sum1 = add i32 %sum0, %tmp2
; CHECK-NEXT: %sum2 = add i32 %sum1, %tmp0
; CHECK-NEXT: %sum3 = add i32 %sum2, %tmp0
; CHECK-NEXT: %sum4 = add i32 %sum3, %tmp5
; CHECK-NEXT: %sum5 = add i32 %sum4, %tmp5
; CHECK-NEXT: %sum6 = add i32 %sum5, %tmp7
; CHECK-NEXT: %sum7 = add i32 %sum6, %tmp8
; CHECK-NEXT: ret i32 %sum7
define i32 @test() {
entry:
%tmp0 = call i32 @TestConst( i32 5 ) readnone ; <i32> [#uses=1]
%tmp1 = call i32 @TestPure( i32 6 ) readonly ; <i32> [#uses=1]
%tmp2 = call i32 @TestNone( i32 7 ) ; <i32> [#uses=1]
store i32 1, i32* @g
%tmp3 = call i32 @TestConst( i32 5 ) readnone ; <i32> [#uses=1]
%tmp4 = call i32 @TestConst( i32 5 ) readnone ; <i32> [#uses=1]
%tmp5 = call i32 @TestPure( i32 6 ) readonly ; <i32> [#uses=1]
%tmp6 = call i32 @TestPure( i32 6 ) readonly ; <i32> [#uses=1]
%tmp7 = call i32 @TestNone( i32 7 ) ; <i32> [#uses=1]
%tmp8 = call i32 @TestNone( i32 7 ) ; <i32> [#uses=1]
%sum0 = add i32 %tmp0, %tmp1 ; <i32> [#uses=1]
%sum1 = add i32 %sum0, %tmp2 ; <i32> [#uses=1]
%sum2 = add i32 %sum1, %tmp3 ; <i32> [#uses=1]
%sum3 = add i32 %sum2, %tmp4 ; <i32> [#uses=1]
%sum4 = add i32 %sum3, %tmp5 ; <i32> [#uses=1]
%sum5 = add i32 %sum4, %tmp6 ; <i32> [#uses=1]
%sum6 = add i32 %sum5, %tmp7 ; <i32> [#uses=1]
%sum7 = add i32 %sum6, %tmp8 ; <i32> [#uses=1]
ret i32 %sum7
}
declare i32 @TestConst(i32) readnone
declare i32 @TestPure(i32) readonly
declare i32 @TestNone(i32)
; CHECK: attributes [[READNONE]] = { readnone }
; CHECK: attributes [[READONLY]] = { readonly }