1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -print-after=localstackalloc <%s >%t 2>&1 && FileCheck <%t %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; Due to a bug in isFrameOffsetLegal we ended up with resolveFrameIndex creating 4*9880d681SAndroid Build Coastguard Worker; addresses with out-of-range displacements. Verify that this no longer happens. 5*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: LD {{3276[8-9]}} 6*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: LD {{327[7-9][0-9]}} 7*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: LD {{32[8-9][0-9][0-9]}} 8*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: LD {{3[3-9][0-9][0-9][0-9]}} 9*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: LD {{[4-9][0-9][0-9][0-9][0-9]}} 10*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: LD {{[1-9][0-9][0-9][0-9][0-9][0-9]+}} 11*9880d681SAndroid Build Coastguard Worker 12*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:e-i64:64-n32:64" 13*9880d681SAndroid Build Coastguard Workertarget triple = "powerpc64le-unknown-linux-gnu" 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Worker%struct.S2760 = type { <2 x float>, %struct.anon, i32, [28 x i8] } 16*9880d681SAndroid Build Coastguard Worker%struct.anon = type { [11 x %struct.anon.0], i64, [6 x { i64, i64 }], [24 x i8] } 17*9880d681SAndroid Build Coastguard Worker%struct.anon.0 = type { [30 x %union.U4DI], i8, [0 x i16], [30 x i8] } 18*9880d681SAndroid Build Coastguard Worker%union.U4DI = type { <4 x i64> } 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker@s2760 = external global %struct.S2760 21*9880d681SAndroid Build Coastguard Worker@fails = external global i32 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Workerdefine void @check2760(%struct.S2760* noalias sret %agg.result, %struct.S2760* byval align 16, %struct.S2760* %arg1, %struct.S2760* byval align 16) { 24*9880d681SAndroid Build Coastguard Workerentry: 25*9880d681SAndroid Build Coastguard Worker %arg0 = alloca %struct.S2760, align 32 26*9880d681SAndroid Build Coastguard Worker %arg2 = alloca %struct.S2760, align 32 27*9880d681SAndroid Build Coastguard Worker %arg1.addr = alloca %struct.S2760*, align 8 28*9880d681SAndroid Build Coastguard Worker %ret = alloca %struct.S2760, align 32 29*9880d681SAndroid Build Coastguard Worker %b1 = alloca %struct.S2760, align 32 30*9880d681SAndroid Build Coastguard Worker %b2 = alloca %struct.S2760, align 32 31*9880d681SAndroid Build Coastguard Worker %2 = bitcast %struct.S2760* %arg0 to i8* 32*9880d681SAndroid Build Coastguard Worker %3 = bitcast %struct.S2760* %0 to i8* 33*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* %3, i64 11104, i32 16, i1 false) 34*9880d681SAndroid Build Coastguard Worker %4 = bitcast %struct.S2760* %arg2 to i8* 35*9880d681SAndroid Build Coastguard Worker %5 = bitcast %struct.S2760* %1 to i8* 36*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %4, i8* %5, i64 11104, i32 16, i1 false) 37*9880d681SAndroid Build Coastguard Worker store %struct.S2760* %arg1, %struct.S2760** %arg1.addr, align 8 38*9880d681SAndroid Build Coastguard Worker %6 = bitcast %struct.S2760* %ret to i8* 39*9880d681SAndroid Build Coastguard Worker call void @llvm.memset.p0i8.i64(i8* %6, i8 0, i64 11104, i32 32, i1 false) 40*9880d681SAndroid Build Coastguard Worker %7 = bitcast %struct.S2760* %b1 to i8* 41*9880d681SAndroid Build Coastguard Worker call void @llvm.memset.p0i8.i64(i8* %7, i8 0, i64 11104, i32 32, i1 false) 42*9880d681SAndroid Build Coastguard Worker %8 = bitcast %struct.S2760* %b2 to i8* 43*9880d681SAndroid Build Coastguard Worker call void @llvm.memset.p0i8.i64(i8* %8, i8 0, i64 11104, i32 32, i1 false) 44*9880d681SAndroid Build Coastguard Worker %b = getelementptr inbounds %struct.S2760, %struct.S2760* %arg0, i32 0, i32 1 45*9880d681SAndroid Build Coastguard Worker %g = getelementptr inbounds %struct.anon, %struct.anon* %b, i32 0, i32 1 46*9880d681SAndroid Build Coastguard Worker %9 = load i64, i64* %g, align 8 47*9880d681SAndroid Build Coastguard Worker %10 = load i64, i64* getelementptr inbounds (%struct.S2760, %struct.S2760* @s2760, i32 0, i32 1, i32 1), align 8 48*9880d681SAndroid Build Coastguard Worker %cmp = icmp ne i64 %9, %10 49*9880d681SAndroid Build Coastguard Worker br i1 %cmp, label %if.then, label %if.end 50*9880d681SAndroid Build Coastguard Worker 51*9880d681SAndroid Build Coastguard Workerif.then: ; preds = %entry 52*9880d681SAndroid Build Coastguard Worker %11 = load i32, i32* @fails, align 4 53*9880d681SAndroid Build Coastguard Worker %inc = add nsw i32 %11, 1 54*9880d681SAndroid Build Coastguard Worker store i32 %inc, i32* @fails, align 4 55*9880d681SAndroid Build Coastguard Worker br label %if.end 56*9880d681SAndroid Build Coastguard Worker 57*9880d681SAndroid Build Coastguard Workerif.end: ; preds = %if.then, %entry 58*9880d681SAndroid Build Coastguard Worker %12 = load i64, i64* getelementptr inbounds (%struct.S2760, %struct.S2760* @s2760, i32 0, i32 1, i32 1), align 8 59*9880d681SAndroid Build Coastguard Worker %b3 = getelementptr inbounds %struct.S2760, %struct.S2760* %ret, i32 0, i32 1 60*9880d681SAndroid Build Coastguard Worker %g4 = getelementptr inbounds %struct.anon, %struct.anon* %b3, i32 0, i32 1 61*9880d681SAndroid Build Coastguard Worker store i64 %12, i64* %g4, align 8 62*9880d681SAndroid Build Coastguard Worker %13 = bitcast %struct.S2760* %agg.result to i8* 63*9880d681SAndroid Build Coastguard Worker %14 = bitcast %struct.S2760* %ret to i8* 64*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %13, i8* %14, i64 11104, i32 32, i1 false) 65*9880d681SAndroid Build Coastguard Worker ret void 66*9880d681SAndroid Build Coastguard Worker} 67*9880d681SAndroid Build Coastguard Worker 68*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) 69*9880d681SAndroid Build Coastguard Worker 70*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) 71*9880d681SAndroid Build Coastguard Worker 72