diff options
Diffstat (limited to 'test/Transforms/GlobalOpt/storepointer-compare.ll')
-rw-r--r-- | test/Transforms/GlobalOpt/storepointer-compare.ll | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/Transforms/GlobalOpt/storepointer-compare.ll b/test/Transforms/GlobalOpt/storepointer-compare.ll new file mode 100644 index 0000000..86eff51 --- /dev/null +++ b/test/Transforms/GlobalOpt/storepointer-compare.ll @@ -0,0 +1,30 @@ +; RUN: llvm-as < %s | opt -globalopt | llvm-dis | \ +; RUN: grep {call void @Actual} + +; Check that a comparison does not prevent an indirect call from being made +; direct. The global will still remain, but indirect call elim is still good. + +@G = internal global void ()* null ; <void ()**> [#uses=2] + +define internal void @Actual() { + ret void +} + +define void @init() { + store void ()* @Actual, void ()** @G + ret void +} + +define void @doit() { + %FP = load void ()** @G ; <void ()*> [#uses=2] + %CC = icmp eq void ()* %FP, null ; <i1> [#uses=1] + br i1 %CC, label %isNull, label %DoCall + +DoCall: ; preds = %0 + call void %FP( ) + ret void + +isNull: ; preds = %0 + ret void +} + |