261 lines · plain
1; RUN: llc < %s > %t2; PR62833 4; Tricky coalescer bug:5; After coalescing %RAX with a virtual register, this instruction was rematted:6;7; %EAX = MOV32rr killed %reg10708;9; This instruction silently defined %RAX, and when rematting removed the10; instruction, the live interval for %RAX was not properly updated. The valno11; referred to a deleted instruction and bad things happened.12;13; The fix is to implicitly define %RAX when coalescing:14;15; %EAX = MOV32rr killed %reg1070, implicit-def %RAX16;17 18target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"19target triple = "x86_64-unknown-linux-gnu"20 21module asm "\09.ident\09\22GCC: (GNU) 4.5.0 20100212 (experimental) LLVM: 95975\22"22 23%0 = type { ptr }24%"BITMAP_WORD[]" = type [2 x i64]25%"uchar[]" = type [1 x i8]26%"char[]" = type [4 x i8]27%"enum dom_state[]" = type [2 x i32]28%"int[]" = type [4 x i32]29%"struct VEC_basic_block_base" = type { i32, i32, [1 x ptr] }30%"struct VEC_basic_block_gc" = type { %"struct VEC_basic_block_base" }31%"struct VEC_edge_base" = type { i32, i32, [1 x ptr] }32%"struct VEC_edge_gc" = type { %"struct VEC_edge_base" }33%"struct VEC_gimple_base" = type { i32, i32, [1 x ptr] }34%"struct VEC_gimple_gc" = type { %"struct VEC_gimple_base" }35%"struct VEC_iv_cand_p_base" = type { i32, i32, [1 x ptr] }36%"struct VEC_iv_cand_p_heap" = type { %"struct VEC_iv_cand_p_base" }37%"struct VEC_iv_use_p_base" = type { i32, i32, [1 x ptr] }38%"struct VEC_iv_use_p_heap" = type { %"struct VEC_iv_use_p_base" }39%"struct VEC_loop_p_base" = type { i32, i32, [1 x ptr] }40%"struct VEC_loop_p_gc" = type { %"struct VEC_loop_p_base" }41%"struct VEC_rtx_base" = type { i32, i32, [1 x ptr] }42%"struct VEC_rtx_gc" = type { %"struct VEC_rtx_base" }43%"struct VEC_tree_base" = type { i32, i32, [1 x ptr] }44%"struct VEC_tree_gc" = type { %"struct VEC_tree_base" }45%"struct _obstack_chunk" = type { ptr, ptr, %"char[]" }46%"struct basic_block_def" = type { ptr, ptr, ptr, ptr, [2 x ptr], ptr, ptr, %"union basic_block_il_dependent", i64, i32, i32, i32, i32, i32 }47%"struct bitmap_element" = type { ptr, ptr, i32, %"BITMAP_WORD[]" }48%"struct bitmap_head_def" = type { ptr, ptr, i32, ptr }49%"struct bitmap_obstack" = type { ptr, ptr, %"struct obstack" }50%"struct block_symbol" = type { [3 x %"union rtunion"], ptr, i64 }51%"struct comp_cost" = type { i32, i32 }52%"struct control_flow_graph" = type { ptr, ptr, ptr, i32, i32, i32, ptr, i32, %"enum dom_state[]", %"enum dom_state[]", i32, i32 }53%"struct cost_pair" = type { ptr, %"struct comp_cost", ptr, ptr }54%"struct def_optype_d" = type { ptr, ptr }55%"struct double_int" = type { i64, i64 }56%"struct edge_def" = type { ptr, ptr, %"union edge_def_insns", ptr, ptr, i32, i32, i32, i32, i64 }57%"struct eh_status" = type opaque58%"struct et_node" = type opaque59%"struct function" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, ptr, i8, i8, i8, i8 }60%"struct gimple_bb_info" = type { ptr, ptr }61%"struct gimple_df" = type { ptr, ptr, ptr, ptr, %"struct pt_solution", %"struct pt_solution", ptr, ptr, ptr, ptr, i8, %"struct ssa_operands" }62%"struct gimple_seq_d" = type { ptr, ptr, ptr }63%"struct gimple_seq_node_d" = type { ptr, ptr, ptr }64%"struct gimple_statement_base" = type { i8, i8, i16, i32, i32, i32, ptr, ptr }65%"struct phi_arg_d[]" = type [1 x %"struct phi_arg_d"]66%"struct gimple_statement_phi" = type { %"struct gimple_statement_base", i32, i32, ptr, %"struct phi_arg_d[]" }67%"struct htab" = type { ptr, ptr, ptr, ptr, i64, i64, i64, i32, i32, ptr, ptr, ptr, ptr, ptr, i32 }68%"struct iv" = type { ptr, ptr, ptr, ptr, i8, i8, i32 }69%"struct iv_cand" = type { i32, i8, i32, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr }70%"struct iv_use" = type { i32, i32, ptr, ptr, ptr, ptr, i32, ptr, ptr }71%"struct ivopts_data" = type { ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, i8, i8 }72%"struct lang_decl" = type opaque73%"struct language_function" = type opaque74%"struct loop" = type { i32, i32, ptr, ptr, %"struct comp_cost", i32, i32, ptr, ptr, ptr, ptr, ptr, %"struct double_int", %"struct double_int", i8, i8, i32, ptr, ptr, i8, ptr }75%"struct loop_exit" = type { ptr, ptr, ptr, ptr }76%"struct loops" = type { i32, ptr, ptr, ptr }77%"struct machine_cfa_state" = type { ptr, i64 }78%"struct machine_function" = type { ptr, ptr, i32, i32, %"int[]", i32, %"struct machine_cfa_state", i32, i8 }79%"struct nb_iter_bound" = type { ptr, %"struct double_int", i8, ptr }80%"struct object_block" = type { ptr, i32, i64, ptr, ptr }81%"struct obstack" = type { i64, ptr, ptr, ptr, ptr, i64, i32, ptr, ptr, ptr, i8 }82%"struct phi_arg_d" = type { %"struct ssa_use_operand_d", ptr, i32 }83%"struct pointer_map_t" = type opaque84%"struct pt_solution" = type { i8, ptr }85%"struct rtx_def" = type { i16, i8, i8, %"union u" }86%"struct section_common" = type { i32 }87%"struct ssa_operand_memory_d" = type { ptr, %"uchar[]" }88%"struct ssa_operands" = type { ptr, i32, i32, i8, ptr, ptr }89%"struct ssa_use_operand_d" = type { ptr, ptr, %0, ptr }90%"struct stack_local_entry" = type opaque91%"struct tree_base" = type <{ i16, i8, i8, i8, [2 x i8], i8 }>92%"struct tree_common" = type { %"struct tree_base", ptr, ptr }93%"struct tree_decl_common" = type { %"struct tree_decl_minimal", ptr, i8, i8, i8, i8, i8, i32, ptr, ptr, ptr, ptr, ptr }94%"struct tree_decl_minimal" = type { %"struct tree_common", i32, i32, ptr, ptr }95%"struct tree_decl_non_common" = type { %"struct tree_decl_with_vis", ptr, ptr, ptr, ptr }96%"struct tree_decl_with_rtl" = type { %"struct tree_decl_common", ptr }97%"struct tree_decl_with_vis" = type { %"struct tree_decl_with_rtl", ptr, ptr, ptr, i8, i8, i8 }98%"struct tree_function_decl" = type { %"struct tree_decl_non_common", ptr, ptr, ptr, ptr, i16, i8, i8 }99%"struct unnamed_section" = type { %"struct section_common", ptr, ptr, ptr }100%"struct use_optype_d" = type { ptr, %"struct ssa_use_operand_d" }101%"struct version_info" = type { ptr, ptr, i8, i32, i8 }102%"union basic_block_il_dependent" = type { ptr }103%"union edge_def_insns" = type { ptr }104%"union gimple_statement_d" = type { %"struct gimple_statement_phi" }105%"union rtunion" = type { ptr }106%"union section" = type { %"struct unnamed_section" }107%"union tree_node" = type { %"struct tree_function_decl" }108%"union u" = type { %"struct block_symbol" }109 110declare fastcc ptr @get_computation_at(ptr, ptr nocapture, ptr nocapture, ptr) nounwind111 112declare fastcc i32 @computation_cost(ptr, i8 zeroext) nounwind113 114define fastcc i64 @get_computation_cost_at(ptr %data, ptr nocapture %use, ptr nocapture %cand, i8 zeroext %address_p, ptr %depends_on, ptr %at, ptr %can_autoinc) nounwind {115entry:116 br i1 undef, label %"100", label %"4"117 118"4": ; preds = %entry119 br i1 undef, label %"6", label %"5"120 121"5": ; preds = %"4"122 unreachable123 124"6": ; preds = %"4"125 br i1 undef, label %"8", label %"7"126 127"7": ; preds = %"6"128 unreachable129 130"8": ; preds = %"6"131 br i1 undef, label %"100", label %"10"132 133"10": ; preds = %"8"134 br i1 undef, label %"17", label %"16"135 136"16": ; preds = %"10"137 unreachable138 139"17": ; preds = %"10"140 br i1 undef, label %"19", label %"18"141 142"18": ; preds = %"17"143 unreachable144 145"19": ; preds = %"17"146 br i1 undef, label %"93", label %"20"147 148"20": ; preds = %"19"149 br i1 undef, label %"23", label %"21"150 151"21": ; preds = %"20"152 unreachable153 154"23": ; preds = %"20"155 br i1 undef, label %"100", label %"25"156 157"25": ; preds = %"23"158 br i1 undef, label %"100", label %"26"159 160"26": ; preds = %"25"161 br i1 undef, label %"30", label %"28"162 163"28": ; preds = %"26"164 unreachable165 166"30": ; preds = %"26"167 br i1 undef, label %"59", label %"51"168 169"51": ; preds = %"30"170 br i1 undef, label %"55", label %"52"171 172"52": ; preds = %"51"173 unreachable174 175"55": ; preds = %"51"176 %0 = icmp ugt i32 0, undef ; <i1> [#uses=1]177 br i1 %0, label %"50.i", label %"9.i"178 179"9.i": ; preds = %"55"180 unreachable181 182"50.i": ; preds = %"55"183 br i1 undef, label %"55.i", label %"54.i"184 185"54.i": ; preds = %"50.i"186 br i1 undef, label %"57.i", label %"55.i"187 188"55.i": ; preds = %"54.i", %"50.i"189 unreachable190 191"57.i": ; preds = %"54.i"192 br label %"63.i"193 194"61.i": ; preds = %"63.i"195 br i1 undef, label %"64.i", label %"62.i"196 197"62.i": ; preds = %"61.i"198 br label %"63.i"199 200"63.i": ; preds = %"62.i", %"57.i"201 br i1 undef, label %"61.i", label %"64.i"202 203"64.i": ; preds = %"63.i", %"61.i"204 unreachable205 206"59": ; preds = %"30"207 br i1 undef, label %"60", label %"82"208 209"60": ; preds = %"59"210 br i1 undef, label %"61", label %"82"211 212"61": ; preds = %"60"213 br i1 undef, label %"62", label %"82"214 215"62": ; preds = %"61"216 br i1 undef, label %"100", label %"63"217 218"63": ; preds = %"62"219 br i1 undef, label %"65", label %"64"220 221"64": ; preds = %"63"222 unreachable223 224"65": ; preds = %"63"225 br i1 undef, label %"66", label %"67"226 227"66": ; preds = %"65"228 unreachable229 230"67": ; preds = %"65"231 %1 = load i32, ptr undef, align 4 ; <i32> [#uses=0]232 br label %"100"233 234"82": ; preds = %"61", %"60", %"59"235 unreachable236 237"93": ; preds = %"19"238 %2 = call fastcc ptr @get_computation_at(ptr undef, ptr %use, ptr %cand, ptr %at) nounwind ; <ptr> [#uses=1]239 br i1 undef, label %"100", label %"97"240 241"97": ; preds = %"93"242 br i1 undef, label %"99", label %"98"243 244"98": ; preds = %"97"245 br label %"99"246 247"99": ; preds = %"98", %"97"248 %3 = phi ptr [ undef, %"98" ], [ %2, %"97" ] ; <ptr> [#uses=1]249 %4 = call fastcc i32 @computation_cost(ptr %3, i8 zeroext undef) nounwind ; <i32> [#uses=1]250 br label %"100"251 252"100": ; preds = %"99", %"93", %"67", %"62", %"25", %"23", %"8", %entry253 %memtmp1.1.0 = phi i32 [ 0, %"99" ], [ 10000000, %entry ], [ 10000000, %"8" ], [ 10000000, %"23" ], [ 10000000, %"25" ], [ undef, %"62" ], [ undef, %"67" ], [ 10000000, %"93" ] ; <i32> [#uses=1]254 %memtmp1.0.0 = phi i32 [ %4, %"99" ], [ 10000000, %entry ], [ 10000000, %"8" ], [ 10000000, %"23" ], [ 10000000, %"25" ], [ undef, %"62" ], [ undef, %"67" ], [ 10000000, %"93" ] ; <i32> [#uses=1]255 %5 = zext i32 %memtmp1.0.0 to i64 ; <i64> [#uses=1]256 %6 = zext i32 %memtmp1.1.0 to i64 ; <i64> [#uses=1]257 %7 = shl i64 %6, 32 ; <i64> [#uses=1]258 %8 = or i64 %7, %5 ; <i64> [#uses=1]259 ret i64 %8260}261