1
0
mirror of https://github.com/c64scene-ar/llvm-6502.git synced 2024-12-17 03:30:28 +00:00
llvm-6502/test/Analysis/GlobalsModRef/purecse.ll
2006-12-02 04:23:10 +00:00

24 lines
518 B
LLVM

; Test that pure functions are cse'd away
; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | not grep sub
int %pure(int %X) {
%Y = add int %X, 1
ret int %Y
}
int %test1(int %X) {
%A = call int %pure(int %X)
%B = call int %pure(int %X)
%C = sub int %A, %B
ret int %C
}
int %test2(int %X, int* %P) {
%A = call int %pure(int %X)
store int %X, int* %P ;; Does not invalidate 'pure' call.
%B = call int %pure(int %X)
%C = sub int %A, %B
ret int %C
}