 Chromium Code Reviews
 Chromium Code Reviews| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 ; Tests if we handle global variables with relocation initializers. | |
| 
Jim Stichnoth
2014/10/03 01:28:09
I'd also like to see a basic cross test for global
 
Karl
2014/10/04 16:28:34
Done. See crosstest/test_global.cpp
 | |
| 2 | |
| 3 ; Test that we handle it in the ICE converter. | |
| 4 ; RUN: %lc2i -i %s --insts | FileCheck %s | |
| 5 | |
| 6 ; Test that we handle it using Subzero's bitcode reader. | |
| 7 ; RUN: %p2i -i %s --insts | FileCheck %s | |
| 8 | |
| 9 @bytes = internal global [7 x i8] c"abcdefg" | |
| 10 ; CHECK: @bytes = internal global [7 x i8] c"abcdefg" | |
| 11 | |
| 12 @ptr_to_ptr = internal global i32 ptrtoint (i32* @ptr to i32) | |
| 13 ; CHECK-NEXT: @ptr_to_ptr = internal global i32 ptrtoint (i32* @ptr to i32) | |
| 14 | |
| 15 @ptr_to_func = internal global i32 ptrtoint (void ()* @func to i32) | |
| 16 ; CHECK-NEXT: @ptr_to_func = internal global i32 ptrtoint (void ()* @func to i32 ) | |
| 17 | |
| 18 @compound = internal global <{ [3 x i8], i32 }> <{ [3 x i8] c"foo", i32 ptrtoint (void ()* @func to i32) }> | |
| 19 ; CHECK-NEXT: @compound = internal global <{ [3 x i8], i32 }> <{ [3 x i8] c"foo" , i32 ptrtoint (void ()* @func to i32) }> | |
| 20 | |
| 21 @ptr = internal global i32 ptrtoint ([7 x i8]* @bytes to i32) | |
| 22 ; CHECK-NEXT: @ptr = internal global i32 ptrtoint ([7 x i8]* @bytes to i32) | |
| 23 | |
| 24 @addend_ptr = internal global i32 add (i32 ptrtoint (i32* @ptr to i32), i32 1) | |
| 25 ; CHECK-NEXT: @addend_ptr = internal global i32 add (i32 ptrtoint (i32* @ptr to i32), i32 1) | |
| 26 | |
| 27 @addend_negative = internal global i32 add (i32 ptrtoint (i32* @ptr to i32), i32 -1) | |
| 28 ; CHECK-NEXT: @addend_negative = internal global i32 add (i32 ptrtoint (i32* @pt r to i32), i32 -1) | |
| 29 | |
| 30 @addend_array1 = internal global i32 add (i32 ptrtoint ([7 x i8]* @bytes to i32) , i32 1) | |
| 31 ; CHECK-NEXT: @addend_array1 = internal global i32 add (i32 ptrtoint ([7 x i8]* @bytes to i32), i32 1) | |
| 32 | |
| 33 @addend_array2 = internal global i32 add (i32 ptrtoint ([7 x i8]* @bytes to i32) , i32 7) | |
| 34 ; CHECK-NEXT: @addend_array2 = internal global i32 add (i32 ptrtoint ([7 x i8]* @bytes to i32), i32 7) | |
| 35 | |
| 36 @addend_array3 = internal global i32 add (i32 ptrtoint ([7 x i8]* @bytes to i32) , i32 9) | |
| 37 ; CHECK-NEXT: @addend_array3 = internal global i32 add (i32 ptrtoint ([7 x i8]* @bytes to i32), i32 9) | |
| 38 | |
| 39 @addend_struct1 = internal global i32 add (i32 ptrtoint (<{ [3 x i8], i32 }>* @c ompound to i32), i32 1) | |
| 40 ; CHECK-NEXT: @addend_struct1 = internal global i32 add (i32 ptrtoint (<{ [3 x i 8], i32 }>* @compound to i32), i32 1) | |
| 41 | |
| 42 @addend_struct2 = internal global i32 add (i32 ptrtoint (<{ [3 x i8], i32 }>* @c ompound to i32), i32 4) | |
| 43 ; CHECK-NEXT: @addend_struct2 = internal global i32 add (i32 ptrtoint (<{ [3 x i 8], i32 }>* @compound to i32), i32 4) | |
| 44 | |
| 45 @ptr_to_func_align = internal global i32 ptrtoint (void ()* @func to i32), align 8 | |
| 46 ; CHECK-NEXT: @ptr_to_func_align = internal global i32 ptrtoint (void ()* @func to i32), align 8 | |
| 47 | |
| 48 @char = internal constant [1 x i8] c"0" | |
| 49 ; CHECK-NEXT: @char = internal constant [1 x i8] c"0" | |
| 50 | |
| 51 @short = internal constant [2 x i8] zeroinitializer | |
| 52 ; CHECK-NEXT: @short = internal constant [2 x i8] zeroinitializer | |
| 53 | |
| 
jvoung (off chromium)
2014/10/03 16:15:30
Maybe test a constant w/ a compound initializer al
 
Karl
2014/10/04 16:28:34
Done.
 | |
| 54 define void @func() { | |
| 55 ret void | |
| 56 } | |
| 57 | |
| 58 ; CHECK-NEXT: define void @func() { | |
| 59 | |
| OLD | NEW |