diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-12-15 04:33:48 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-12-15 04:33:48 +0000 |
commit | adeb0a6e64c5a63e891e016226645f9595d00959 (patch) | |
tree | 81da09ffb7b6ca34fa001aac96be0147e42058cd /test/Other/constant-fold-gep.ll | |
parent | ca072a39778933df4264ae393bd0ca797db59df6 (diff) | |
download | external_llvm-adeb0a6e64c5a63e891e016226645f9595d00959.tar.gz external_llvm-adeb0a6e64c5a63e891e016226645f9595d00959.tar.bz2 external_llvm-adeb0a6e64c5a63e891e016226645f9595d00959.zip |
Make constant folding for GEPs a bit more aggressive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146639 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Other/constant-fold-gep.ll')
-rw-r--r-- | test/Other/constant-fold-gep.ll | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/Other/constant-fold-gep.ll b/test/Other/constant-fold-gep.ll index e4521d5184..79ddaf2d12 100644 --- a/test/Other/constant-fold-gep.ll +++ b/test/Other/constant-fold-gep.ll @@ -102,14 +102,17 @@ @N = constant i64* getelementptr ({ i64, i64 }* null, i32 0, i32 1) @O = constant i64* getelementptr ([2 x i64]* null, i32 0, i32 1) -; Fold GEP of a GEP. Theoretically some of these cases could be folded -; without using targetdata, however that's not implemented yet. +; Fold GEP of a GEP. Very simple cases are folded without targetdata. +; PLAIN: @Y = global [3 x { i32, i32 }]* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 2) ; PLAIN: @Z = global i32* getelementptr inbounds (i32* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 0, i64 1, i32 0), i64 1) +; OPT: @Y = global [3 x { i32, i32 }]* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 2) ; OPT: @Z = global i32* getelementptr (i32* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 0, i64 1, i32 0), i64 1) +; TO: @Y = global [3 x { i32, i32 }]* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 2) ; TO: @Z = global i32* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 0, i64 1, i32 1) @ext = external global [3 x { i32, i32 }] +@Y = global [3 x { i32, i32 }]* getelementptr inbounds ([3 x { i32, i32 }]* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 1), i64 1) @Z = global i32* getelementptr inbounds (i32* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 0, i64 1, i32 0), i64 1) ; Duplicate all of the above as function return values rather than |