summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-10-10 23:12:33 +0000
committerChris Lattner <sabre@nondot.org>2004-10-10 23:12:33 +0000
commitcd1e756469791be1cecffbb516c832036d338826 (patch)
tree3395e7b14c3d27a3cb9b275ad29a237d0acb2ccc
parent98e600b587801a906adbe0a6346f291c0265532f (diff)
downloadbcm5719-llvm-cd1e756469791be1cecffbb516c832036d338826.tar.gz
bcm5719-llvm-cd1e756469791be1cecffbb516c832036d338826.zip
Another testcase. We should be able to devirtualize the call even though
we cannot completely eliminate the global. llvm-svn: 16900
-rw-r--r--llvm/test/Regression/Transforms/GlobalOpt/storepointer-compare.llx28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/test/Regression/Transforms/GlobalOpt/storepointer-compare.llx b/llvm/test/Regression/Transforms/GlobalOpt/storepointer-compare.llx
new file mode 100644
index 00000000000..a6e8ea3d2ee
--- /dev/null
+++ b/llvm/test/Regression/Transforms/GlobalOpt/storepointer-compare.llx
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | 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
+
+implementation
+
+internal void %Actual() {
+ ret void
+}
+
+void %init() {
+ store void()* %Actual, void()** %G
+ ret void
+}
+
+void %doit() {
+ %FP = load void()** %G
+ %CC = seteq void()* %FP, null
+ br bool %CC, label %isNull, label %DoCall
+DoCall:
+ call void %FP()
+ ret void
+isNull:
+ ret void
+}
OpenPOWER on IntegriCloud