From 36559a4bc852d69a019e33561c196f705fae86f8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 31 Jan 2005 04:49:22 +0000 Subject: [PATCH] New testcase git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19946 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/cast-load-gep.ll | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/Transforms/InstCombine/cast-load-gep.ll diff --git a/test/Transforms/InstCombine/cast-load-gep.ll b/test/Transforms/InstCombine/cast-load-gep.ll new file mode 100644 index 00000000000..9c997b887fd --- /dev/null +++ b/test/Transforms/InstCombine/cast-load-gep.ll @@ -0,0 +1,22 @@ +; RUN: llvm-as < %s | opt -instcombine -globaldce | llvm-dis | not grep Array + +; Pulling the cast out of the load allows us to eliminate the load, and then +; the whole array. + +%unop = type {int } +%op = type {float} + +%Array = internal constant [1 x %op* (%op*)*] [ %op* (%op*)* %foo ] + +implementation + +%op* %foo(%op* %X) { + ret %op* %X +} + +%unop* %caller(%op* %O) { + %tmp = load %unop* (%op*)** cast ([1 x %op* (%op*)*]* %Array to %unop* (%op*)**) + %tmp.2 = call %unop* (%op*)* %tmp(%op* %O) + ret %unop* %tmp.2 +} +