2007-04-15 09:21:47 +00:00
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -adce | llvm-dis | \
|
|
|
|
; RUN: not grep {call void %f1}
|
|
|
|
; END.
|
|
|
|
|
2005-09-19 23:48:04 +00:00
|
|
|
declare void %f1()
|
|
|
|
declare void %f2()
|
|
|
|
declare void %f3()
|
|
|
|
declare void %f4()
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
2005-09-20 00:41:55 +00:00
|
|
|
int %test1(int %X, bool %D) {
|
|
|
|
E:
|
|
|
|
%C = seteq int %X, 0
|
|
|
|
br bool %C, label %T, label %F
|
|
|
|
T:
|
|
|
|
br bool %C, label %B, label %A
|
|
|
|
A:
|
|
|
|
call void %f1()
|
|
|
|
br bool %D, label %T, label %F
|
|
|
|
B:
|
|
|
|
call void %f2()
|
|
|
|
ret int 345
|
|
|
|
F:
|
|
|
|
call void %f3()
|
|
|
|
ret int 123
|
|
|
|
}
|
|
|
|
|
2005-09-19 23:48:04 +00:00
|
|
|
int %test2(int %X, bool %D) {
|
|
|
|
E:
|
|
|
|
%C = seteq int %X, 0
|
|
|
|
br bool %C, label %T, label %F
|
|
|
|
T:
|
|
|
|
%P = phi bool [true, %E], [%C, %A]
|
|
|
|
br bool %P, label %B, label %A
|
|
|
|
A:
|
|
|
|
call void %f1()
|
|
|
|
br bool %D, label %T, label %F
|
|
|
|
B:
|
|
|
|
call void %f2()
|
|
|
|
ret int 345
|
|
|
|
F:
|
|
|
|
call void %f3()
|
|
|
|
ret int 123
|
|
|
|
}
|
|
|
|
|
2005-09-20 01:43:41 +00:00
|
|
|
int %test3(int %X, bool %D, int* %AP, int* %BP) {
|
|
|
|
E:
|
|
|
|
%C = seteq int %X, 0
|
|
|
|
br bool %C, label %T, label %F
|
|
|
|
T:
|
|
|
|
call void %f3() ;; Inst in block.
|
|
|
|
%XX = load int* %AP
|
|
|
|
store int %XX, int* %BP
|
|
|
|
br bool %C, label %B, label %A
|
|
|
|
A:
|
|
|
|
call void %f1()
|
|
|
|
br bool %D, label %T, label %F
|
|
|
|
B:
|
|
|
|
call void %f2()
|
|
|
|
ret int 345
|
|
|
|
F:
|
|
|
|
call void %f3()
|
|
|
|
ret int 123
|
|
|
|
}
|