From ccfebfbb36ff761d09e51fc9b8bf67695b481253 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 18 Apr 2002 15:39:50 +0000 Subject: [PATCH] Check in the first test: make sure getelementptr gets folded llvm-svn: 2288 --- .../Transforms/InstCombine/Makefile | 10 +++++++++ .../Transforms/InstCombine/getelementptr.ll | 21 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 llvm/test/Regression/Transforms/InstCombine/Makefile create mode 100644 llvm/test/Regression/Transforms/InstCombine/getelementptr.ll diff --git a/llvm/test/Regression/Transforms/InstCombine/Makefile b/llvm/test/Regression/Transforms/InstCombine/Makefile new file mode 100644 index 000000000000..91acd4d481b9 --- /dev/null +++ b/llvm/test/Regression/Transforms/InstCombine/Makefile @@ -0,0 +1,10 @@ + +LEVEL = ../../../.. +include $(LEVEL)/test/Makefile.tests + +TESTS := $(wildcard *.ll) + +all:: $(addprefix Output/, $(TESTS:%.ll=%.ll.out)) + +Output/%.ll.out: %.ll Output/.dir $(LOPT) + -$(TESTRUNR) $< diff --git a/llvm/test/Regression/Transforms/InstCombine/getelementptr.ll b/llvm/test/Regression/Transforms/InstCombine/getelementptr.ll new file mode 100644 index 000000000000..c22871b3b126 --- /dev/null +++ b/llvm/test/Regression/Transforms/InstCombine/getelementptr.ll @@ -0,0 +1,21 @@ +; The %A getelementptr instruction should be eliminated here + +; RUN: if as < %s | opt -instcombine -dce | dis | grep getelementptr | grep -v '%C' +; RUN: then exit 1 +; RUN: else exit 0 +; RUN: fi + +implementation + +int *"foo"(int * %I) +begin + %A = getelementptr int* %I, uint 17 + store int 23, int* %A + + %B = load int* %A + store int %B, int* %A, uint 0 + + %C = getelementptr int* %A + ret int* %C +end +