diff options
author | Dan Gohman <gohman@apple.com> | 2009-05-27 02:00:53 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-05-27 02:00:53 +0000 |
commit | 4a4f767235dac50965fc266fb822d9a2e37d5212 (patch) | |
tree | 82e79a225d914dc411aa244ae53dec5e780bf285 /test | |
parent | 72776d219014f6b07485e7dcc5a818849904e720 (diff) | |
download | external_llvm-4a4f767235dac50965fc266fb822d9a2e37d5212.zip external_llvm-4a4f767235dac50965fc266fb822d9a2e37d5212.tar.gz external_llvm-4a4f767235dac50965fc266fb822d9a2e37d5212.tar.bz2 |
Teach SCEVExpander to avoid creating over-indexed GEP indices when
possible. For example, it now emits
%p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 2, i64 %tmp, i64 1
instead of the equivalent but less obvious
%p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 %tmp, i64 19
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72452 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/IndVarSimplify/preserve-gep-remainder.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll b/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll new file mode 100644 index 0000000..95726ea --- /dev/null +++ b/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll @@ -0,0 +1,19 @@ +; RUN: llvm-as < %s | opt -indvars | llvm-dis \ +; RUN: | grep {\[%\]p.2.ip.1 = getelementptr \\\[3 x \\\[3 x double\\\]\\\]\\* \[%\]p, i64 2, i64 \[%\]tmp, i64 1} + +; Indvars shouldn't expand this to +; %p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 %tmp, i64 19 +; or something. That's valid, but more obscure. + +define void @foo([3 x [3 x double]]* noalias %p) nounwind { +entry: + br label %loop + +loop: + %i = phi i64 [ 0, %entry ], [ %i.next, %loop ] + %ip = add i64 %i, 1 + %p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 2, i64 %ip, i64 1 + volatile store double 0.0, double* %p.2.ip.1 + %i.next = add i64 %i, 1 + br label %loop +} |