diff options
author | Duncan Sands <baldrick@free.fr> | 2009-03-02 09:18:21 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2009-03-02 09:18:21 +0000 |
commit | 5b7cfb02f7186dde37234e692a5f848adb68cc18 (patch) | |
tree | 54f5e651e02a569f68043419a2fb4dd4ed461a38 /test | |
parent | 540d73f0cb32a3c520a6951c68393135008e8a17 (diff) | |
download | external_llvm-5b7cfb02f7186dde37234e692a5f848adb68cc18.zip external_llvm-5b7cfb02f7186dde37234e692a5f848adb68cc18.tar.gz external_llvm-5b7cfb02f7186dde37234e692a5f848adb68cc18.tar.bz2 |
Fix PR3694: add an instcombine micro-optimization that helps
clean up when using variable length arrays in llvm-gcc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65832 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll b/test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll new file mode 100644 index 0000000..1e136f5 --- /dev/null +++ b/test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {getelementptr i32} +; PR3694 + +define i32 @e(i32 %m, i32 %n) nounwind { +entry: + %0 = alloca i32, i32 %n, align 4 ; <i32*> [#uses=2] + %1 = bitcast i32* %0 to [0 x i32]* ; <[0 x i32]*> [#uses=1] + call void @f(i32* %0) nounwind + %2 = getelementptr [0 x i32]* %1, i32 0, i32 %m ; <i32*> [#uses=1] + %3 = load i32* %2, align 4 ; <i32> [#uses=1] + ret i32 %3 +} + +declare void @f(i32*) |