summaryrefslogtreecommitdiff
path: root/test/Other
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-02-02 01:41:39 +0000
committerDan Gohman <gohman@apple.com>2010-02-02 01:41:39 +0000
commit6acb86dcfa1ff4e38d2f189ab09e3fbe22f248a7 (patch)
tree238680b525fa31787298b84af2f9fe780ac11c98 /test/Other
parent8db08df5d3668e92cf4ba6f35743464c42fa986f (diff)
downloadllvm-6acb86dcfa1ff4e38d2f189ab09e3fbe22f248a7.tar.gz
llvm-6acb86dcfa1ff4e38d2f189ab09e3fbe22f248a7.tar.bz2
llvm-6acb86dcfa1ff4e38d2f189ab09e3fbe22f248a7.tar.xz
Factor out alignof expression folding into a separate function and
generalize it to handle more cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95045 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Other')
-rw-r--r--test/Other/constant-fold-gep.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Other/constant-fold-gep.ll b/test/Other/constant-fold-gep.ll
index bb93dc761c..10ff21d4ef 100644
--- a/test/Other/constant-fold-gep.ll
+++ b/test/Other/constant-fold-gep.ll
@@ -64,18 +64,21 @@
; PLAIN: @d = constant i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11)
; PLAIN: @e = constant i64 ptrtoint (double* getelementptr (%1* null, i64 0, i32 2) to i64)
; PLAIN: @f = constant i64 1
+; PLAIN: @g = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
; OPT: @a = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310)
; OPT: @b = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
; OPT: @c = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2)
; OPT: @d = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11)
; OPT: @e = constant i64 ptrtoint (double* getelementptr (%1* null, i64 0, i32 2) to i64)
; OPT: @f = constant i64 1
+; OPT: @g = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
; TO: @a = constant i64 18480
; TO: @b = constant i64 8
; TO: @c = constant i64 16
; TO: @d = constant i64 88
; TO: @e = constant i64 16
; TO: @f = constant i64 1
+; TO: @g = constant i64 8
@a = constant i64 mul (i64 3, i64 mul (i64 ptrtoint ({[7 x double], [7 x double]}* getelementptr ({[7 x double], [7 x double]}* null, i64 11) to i64), i64 5))
@b = constant i64 ptrtoint ([13 x double]* getelementptr ({i1, [13 x double]}* null, i64 0, i32 1) to i64)
@@ -83,6 +86,7 @@
@d = constant i64 ptrtoint (double* getelementptr ([13 x double]* null, i64 0, i32 11) to i64)
@e = constant i64 ptrtoint (double* getelementptr ({double, float, double, double}* null, i64 0, i32 2) to i64)
@f = constant i64 ptrtoint (<{ i16, i128 }>* getelementptr ({i1, <{ i16, i128 }>}* null, i64 0, i32 1) to i64)
+@g = constant i64 ptrtoint ({double, double}* getelementptr ({i1, {double, double}}* null, i64 0, i32 1) to i64)
; The target-dependent folder should cast GEP indices to integer-sized pointers.
@@ -229,6 +233,10 @@ define i1* @hoo1() nounwind {
; PLAIN: %t = bitcast i64 1 to i64
; PLAIN: ret i64 %t
; PLAIN: }
+; PLAIN: define i64 @fg() nounwind {
+; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
+; PLAIN: ret i64 %t
+; PLAIN: }
; OPT: define i64 @fa() nounwind {
; OPT: ret i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310)
; OPT: }
@@ -247,6 +255,9 @@ define i1* @hoo1() nounwind {
; OPT: define i64 @ff() nounwind {
; OPT: ret i64 1
; OPT: }
+; OPT: define i64 @fg() nounwind {
+; OPT: ret i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
+; OPT: }
; TO: define i64 @fa() nounwind {
; TO: ret i64 18480
; TO: }
@@ -265,6 +276,9 @@ define i1* @hoo1() nounwind {
; TO: define i64 @ff() nounwind {
; TO: ret i64 1
; TO: }
+; TO: define i64 @fg() nounwind {
+; TO: ret i64 8
+; TO: }
; SCEV: Classifying expressions for: @fa
; SCEV: %t = bitcast i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) to i64
; SCEV: --> (2310 * sizeof(double))
@@ -283,6 +297,9 @@ define i1* @hoo1() nounwind {
; SCEV: Classifying expressions for: @ff
; SCEV: %t = bitcast i64 1 to i64
; SCEV: --> 1
+; SCEV: Classifying expressions for: @fg
+; SCEV: %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
+; SCEV: --> alignof(double)
define i64 @fa() nounwind {
%t = bitcast i64 mul (i64 3, i64 mul (i64 ptrtoint ({[7 x double], [7 x double]}* getelementptr ({[7 x double], [7 x double]}* null, i64 11) to i64), i64 5)) to i64
@@ -308,6 +325,10 @@ define i64 @ff() nounwind {
%t = bitcast i64 ptrtoint (<{ i16, i128 }>* getelementptr ({i1, <{ i16, i128 }>}* null, i64 0, i32 1) to i64) to i64
ret i64 %t
}
+define i64 @fg() nounwind {
+ %t = bitcast i64 ptrtoint ({double, double}* getelementptr ({i1, {double, double}}* null, i64 0, i32 1) to i64) to i64
+ ret i64 %t
+}
; PLAIN: define i64* @fM() nounwind {
; PLAIN: %t = bitcast i64* getelementptr (i64* null, i32 1) to i64*