blob: 09e20a8adb26f7e7f31bcb839090870a4a1ffbdf [file] [log] [blame]
Dan Gohman18800922009-09-11 18:01:28 +00001; RUN: opt < %s -globalopt -S | \
Chandler Carrutha5a29f92012-07-02 12:47:22 +00002; RUN: grep "call void @Actual"
Chris Lattnercd1e7562004-10-10 23:12:33 +00003
4; Check that a comparison does not prevent an indirect call from being made
5; direct. The global will still remain, but indirect call elim is still good.
6
Tanya Lattner5640bd12008-03-01 09:15:35 +00007@G = internal global void ()* null ; <void ()**> [#uses=2]
Chris Lattnercd1e7562004-10-10 23:12:33 +00008
Tanya Lattner5640bd12008-03-01 09:15:35 +00009define internal void @Actual() {
10 ret void
Chris Lattnercd1e7562004-10-10 23:12:33 +000011}
12
Tanya Lattner5640bd12008-03-01 09:15:35 +000013define void @init() {
14 store void ()* @Actual, void ()** @G
15 ret void
Chris Lattnercd1e7562004-10-10 23:12:33 +000016}
17
Tanya Lattner5640bd12008-03-01 09:15:35 +000018define void @doit() {
19 %FP = load void ()** @G ; <void ()*> [#uses=2]
20 %CC = icmp eq void ()* %FP, null ; <i1> [#uses=1]
21 br i1 %CC, label %isNull, label %DoCall
22
23DoCall: ; preds = %0
24 call void %FP( )
25 ret void
26
27isNull: ; preds = %0
28 ret void
Chris Lattnercd1e7562004-10-10 23:12:33 +000029}
Tanya Lattner5640bd12008-03-01 09:15:35 +000030