63 lines · plain
1; RUN: opt -S -mtriple=mips64-mti-linux-gnu -codegenprepare < %s | FileCheck %s2 3; Test that if an address that was sunk from a dominating bb, used in a4; select that is erased along with its' trivally dead operand, that the5; sunken address is not reused if the same address computation occurs6; after the select. Previously, this caused a ICE.7 8%struct.az = type { i32, ptr }9%struct.bt = type { i32 }10%struct.f = type { %struct.ax, %union.anon }11%struct.ax = type { ptr }12%union.anon = type { %struct.bd }13%struct.bd = type { i64 }14%struct.bg = type { i32, i32 }15%struct.ap = type { i32, i32 }16 17@ch = common global %struct.f zeroinitializer, align 818@j = common global ptr null, align 819@ck = common global i32 0, align 420@h = common global i32 0, align 421@.str = private unnamed_addr constant [1 x i8] zeroinitializer, align 122 23define internal void @probestart() {24entry:25 %load0 = load ptr, ptr @j, align 826 %bw = getelementptr inbounds %struct.az, ptr %load0, i64 0, i32 127 %load1 = load i32, ptr @h, align 428 %cond = icmp eq i32 %load1, 029 br i1 %cond, label %sw.bb, label %cl30 31sw.bb: ; preds = %entry32 %call = tail call inreg { i64, i64 } @ba(ptr @ch)33 br label %cl34 35cl: ; preds = %sw.bb, %entry36 %load2 = load ptr, ptr %bw, align 837 %tobool = icmp eq ptr %load2, null38 %load3 = load i32, ptr @ck, align 439 %.sink5 = select i1 %tobool, ptr getelementptr (%struct.bg, ptr getelementptr inbounds (%struct.f, ptr @ch, i64 0, i32 1), i64 0, i32 1), ptr getelementptr (%struct.ap, ptr getelementptr inbounds (%struct.f, ptr @ch, i64 0, i32 1), i64 0, i32 1)40 store i32 %load3, ptr %.sink5, align 441 store i32 1, ptr getelementptr inbounds (%struct.f, ptr @ch, i64 0, i32 1, i32 0, i32 0), align 842 %load4 = load ptr, ptr %bw, align 843 tail call void (ptr, ...) @a(ptr @.str, ptr %load4)44 ret void45}46 47; CHECK-LABEL: @probestart()48; CHECK-LABEL: entry:49; CHECK: %[[I0:[a-z0-9]+]] = load ptr, ptr @j50; CHECK-LABEL: cl:51 52; CHECK-NOT: %{{[a-z0-9]+}} = load ptr, ptr %bw53; CHECK-NOT: %{{[.a-z0-9]}} = select54; CHECK-NOT: %{{[a-z0-9]+}} = load ptr, ptr %bw55 56; CHECK: %sunkaddr = getelementptr inbounds i8, ptr %[[I0]], i64 857; CHECK-NEXT: %{{[a-z0-9]+}} = load ptr, ptr %sunkaddr58; CHECK-NEXT: tail call void (ptr, ...) @a59 60declare inreg { i64, i64 } @ba(ptr)61 62declare void @a(ptr, ...)63