55 lines · plain
1; RUN: llc %s -o - -verify-machineinstrs | FileCheck %s2 3target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"4target triple = "thumbv7-unknown-unknown"5 6%struct.ref_s = type { %union.v, i16, i16 }7%union.v = type { i32 }8%struct.gs_color_s = type { i16, i16, i16, i16, i8, i8 }9 10; In this case, the if converter was cloning the return instruction so that we had11; r2 = ...12; return [pred] r2<dead,def>13; ldr <r2, kill>14; return15; The problem here was that the dead def on the first return was making the machine verifier16; think that the load read from an undefined register. We need to remove the dead flag from17; the return, and also add an implicit use of the prior value of r2.18 19; CHECK: ldrh20 21; Function Attrs: minsize nounwind optsize ssp22define i32 @test(ptr %pref1, ptr %pref2, ptr %tmp152) #0 {23bb:24 %nref = alloca %struct.ref_s, align 425 %tmp46 = call ptr @name_string_ref(ptr %pref1, ptr %nref) #226 %tmp153 = load ptr, ptr %tmp152, align 427 %tmp155 = load ptr, ptr %pref2, align 428 %tmp162 = getelementptr inbounds %struct.gs_color_s, ptr %tmp153, i32 0, i32 129 %tmp163 = load i16, ptr %tmp162, align 230 %tmp164 = getelementptr inbounds %struct.gs_color_s, ptr %tmp155, i32 0, i32 131 %tmp165 = load i16, ptr %tmp164, align 232 %tmp166 = icmp eq i16 %tmp163, %tmp16533 br i1 %tmp166, label %bb167, label %bb17334 35bb167: ; preds = %bb36 %tmp168 = getelementptr inbounds %struct.gs_color_s, ptr %tmp153, i32 0, i32 237 %tmp169 = load i16, ptr %tmp168, align 238 %tmp170 = getelementptr inbounds %struct.gs_color_s, ptr %tmp155, i32 0, i32 239 %tmp171 = load i16, ptr %tmp170, align 240 %tmp172 = icmp eq i16 %tmp169, %tmp17141 br label %bb17342 43bb173: ; preds = %bb167, %bb44 %tmp174 = phi i1 [ false, %bb ], [ %tmp172, %bb167 ]45 %tmp175 = zext i1 %tmp174 to i3246 ret i32 %tmp17547}48 49; Function Attrs: minsize optsize50declare ptr @name_string_ref(ptr, ptr) #151 52attributes #0 = { minsize nounwind optsize }53attributes #1 = { minsize optsize }54attributes #2 = { minsize nounwind optsize }55