[llvm-commits] [PATCH] Test cases for constant gep's with various address spaces.

Chandler Carruth chandlerc at gmail.com
Wed Oct 24 15:44:28 PDT 2012



================
Comment at: test/Transforms/InstCombine/opt-constant-fold-gep-0.ll:6-7
@@ +5,4 @@
+
+; OPT: ModuleID = '<stdin>'
+; OPT: target datalayout = "e-p:128:128:128-p1:32:32:32-p2:8:8:8-p3:16:16:16-p4:64:64:64-p5:96:96:96-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32"
+
----------------
Er, why are you testing this?

================
Comment at: test/Transforms/InstCombine/opt-constant-fold-gep-0.ll:3
@@ +2,3 @@
+; folding in the optimizers.
+; RUN: opt -S -o - -instcombine -globalopt < %s | FileCheck --check-prefix=OPT %s
+target datalayout = "e-p:128:128:128-p1:32:32:32-p2:8:8:8-p3:16:16:16-p4:64:64:64-p5:96:96:96-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32"
----------------
If you only care about one FileCheck prefix, just use the default one please.

================
Comment at: test/Transforms/InstCombine/opt-constant-fold-gep-0.ll:55
@@ +54,3 @@
+
+; OPT: @M = constant i64 addrspace(5)* inttoptr (i96 8 to i64 addrspace(5)*)
+; OPT: @N = constant i64 addrspace(5)* inttoptr (i96 8 to i64 addrspace(5)*)
----------------
Please continue attaching the assertion to the code that it is testing.

================
Comment at: test/Transforms/InstCombine/opt-constant-fold-gep-0.ll:65
@@ +64,3 @@
+; OPT: @ext = external addrspace(3) global [3 x { i32, i32 }]
+; OPT: @Y = global [3 x { i32, i32 }] addrspace(3)* getelementptr ([3 x { i32, i32 }] addrspace(3)* @ext, i16 2)
+ at ext = external addrspace(3) global [3 x { i32, i32 }]
----------------
Here as well

================
Comment at: test/Transforms/InstCombine/opt-constant-fold-gep-0.ll:76-78
@@ +75,5 @@
+
+; OPT: define i8 addrspace(1)* @goo8() nounwind {
+; OPT:   ret i8 addrspace(1)* null
+; OPT: }
+; OPT: define i1 addrspace(2)* @goo1() nounwind {
----------------
Rather than testing the exact output of the function, you should sink this to live next to the function, and do a more weak assertion:

define i8 addrspace(1)* @goo8() {
; CHECK: @goo8
; CHECK: ret i8 addrspace(1)* null
  ret ....
}

================
Comment at: test/Transforms/InstCombine/to-constant-fold-gep-0.ll:1-2
@@ +1,3 @@
+; "TO" - Optimizations and targetdata. This tests target-dependent
+; folding in the optimizers.
+; RUN: opt -S -o - -instcombine -globalopt < %s | FileCheck --check-prefix=TO %s
----------------
Are these the same set of tests as above? If so, they should be in th esame file with different prefixes.

If there is a mixture, I would factor the shared tests out, and then add a file with the additional tests.

Finally, 'TO' is not a well known acronym. Please spell it out.


http://llvm-reviews.chandlerc.com/D79



More information about the llvm-commits mailing list