brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · d206cde Raw
75 lines · plain
1; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=thumb-apple-darwin -arm-global-merge -global-merge-group-by-use=false -global-merge-on-const=true | FileCheck %s2; Test the ARMGlobalMerge pass.  Use -mtriple=thumb because it has a small3; value for the maximum offset (127).4 5; A local array that exceeds the maximum offset should not be merged.6; CHECK: g0:7@g0 = internal global [32 x i32] [ i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 1, i32 2 ]8 9; Global variables marked with "used" attribute must be kept10; CHECK: g811@g8 = internal global i32 012@llvm.used = appending global [1 x ptr] [ptr @g8], section "llvm.metadata"13 14; Global used in landing pad instruction must be kept15; CHECK: ZTIi16@_ZTIi = internal global ptr null17 18define i32 @_Z9exceptioni(i32 %arg) personality ptr @__gxx_personality_sj0 {19bb:20  %tmp = invoke i32 @_Z14throwSomethingi(i32 %arg)21          to label %bb9 unwind label %bb122 23bb1:                                              ; preds = %bb24  %tmp2 = landingpad { ptr, i32 }25          catch ptr @_ZTIi26  %tmp3 = extractvalue { ptr, i32 } %tmp2, 127  %tmp4 = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIi)28  %tmp5 = icmp eq i32 %tmp3, %tmp429  br i1 %tmp5, label %bb6, label %bb1030 31bb6:                                              ; preds = %bb132  %tmp7 = extractvalue { ptr, i32 } %tmp2, 033  %tmp8 = tail call ptr @__cxa_begin_catch(ptr %tmp7)34  tail call void @__cxa_end_catch()35  br label %bb936 37bb9:                                              ; preds = %bb6, %bb38  %res.0 = phi i32 [ 0, %bb6 ], [ %tmp, %bb ]39  ret i32 %res.040 41bb10:                                             ; preds = %bb142  resume { ptr, i32 } %tmp243}44 45declare i32 @_Z14throwSomethingi(i32)46 47declare i32 @__gxx_personality_sj0(...)48 49declare i32 @llvm.eh.typeid.for(ptr)50 51declare ptr @__cxa_begin_catch(ptr)52 53declare void @__cxa_end_catch()54 55; CHECK: g3:56; CHECK: _MergedGlobals:57@g1 = internal global i32 158@g2 = internal global i32 259 60; Make sure that the complete variable fits within the range of the maximum61; offset.  Having the starting offset in range is not sufficient.62; When this works properly, @g3 is not merged.63@g3 = internal global [30 x i32] [ i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10 ], align 464 65; Global variables that can be placed in BSS should be kept together in a66; separate pool of merged globals.67; CHECK: _MergedGlobals.168@g4 = internal global i32 069@g5 = internal global i32 070 71; Global variables that are constant can be merged together72; CHECK: _MergedGlobals.273@g6 = internal constant [12 x i32] zeroinitializer, align 474@g7 = internal constant [12 x i32] zeroinitializer, align 475