Index: lib/Target/PowerPC/PPCTargetMachine.cpp =================================================================== --- lib/Target/PowerPC/PPCTargetMachine.cpp +++ lib/Target/PowerPC/PPCTargetMachine.cpp @@ -315,7 +315,7 @@ if (UsePrefetching) addPass(createLoopDataPrefetchPass()); - if (TM->getOptLevel() == CodeGenOpt::Aggressive && EnableGEPOpt) { + if (TM->getOptLevel() >= CodeGenOpt::Default && EnableGEPOpt) { // Call SeparateConstOffsetFromGEP pass to extract constants within indices // and lower a GEP with multiple indices to either arithmetic operations or // multiple GEPs with single index. Index: test/CodeGen/PowerPC/2007-09-07-LoadStoreIdxForms.ll =================================================================== --- test/CodeGen/PowerPC/2007-09-07-LoadStoreIdxForms.ll +++ test/CodeGen/PowerPC/2007-09-07-LoadStoreIdxForms.ll @@ -1,4 +1,5 @@ -; RUN: llc < %s -march=ppc64 | FileCheck %s +; RUN: llc < %s -march=ppc64 -O1 | FileCheck %s +; RUN: llc < %s -march=ppc64 | FileCheck --check-prefix=CHECK-OPT %s %struct.__db_region = type { %struct.__mutex_t, [4 x i8], %struct.anon, i32, [1 x i32] } %struct.__mutex_t = type { i32 } @@ -15,6 +16,24 @@ ; CHECK: @foo ; CHECK: lwzx ; CHECK: blr +; CHECK-OPT: @foo +; CHECK-OPT: lwz +; CHECK-OPT: blr } +define signext i32 @test(i32* noalias nocapture readonly %b, i32 signext %n) { +entry: + %idxprom = sext i32 %n to i64 + %arrayidx = getelementptr inbounds i32, i32* %b, i64 %idxprom + %0 = load i32, i32* %arrayidx, align 4 + %mul = mul nsw i32 %0, 7 + ret i32 %mul + +; CHECK-OPT: @test +; CHECK-OPT: lwzx +; CHECK-OPT: blr + +} + + declare i32 @bork(...) Index: test/CodeGen/PowerPC/fp2int2fp-ppcfp128.ll =================================================================== --- test/CodeGen/PowerPC/fp2int2fp-ppcfp128.ll +++ test/CodeGen/PowerPC/fp2int2fp-ppcfp128.ll @@ -2,9 +2,9 @@ target datalayout = "E-m:e-i64:64-n32:64" target triple = "powerpc64-bgq-linux" -define linkonce_odr double @test1() { +define linkonce_odr double @test1(ppc_fp128 %input) { entry: - %conv6.i.i = fptosi ppc_fp128 undef to i64 + %conv6.i.i = fptosi ppc_fp128 %input to i64 %conv.i = sitofp i64 %conv6.i.i to double ret double %conv.i Index: test/CodeGen/PowerPC/lbzux.ll =================================================================== --- test/CodeGen/PowerPC/lbzux.ll +++ test/CodeGen/PowerPC/lbzux.ll @@ -2,7 +2,7 @@ target triple = "powerpc64-unknown-linux-gnu" ; RUN: llc -disable-ppc-unaligned < %s | FileCheck %s -define fastcc void @allocateSpace(i1 %cond1, i1 %cond2) nounwind { +define fastcc void @allocateSpace(i1 %cond1, i1 %cond2, i32 %offset) nounwind { entry: %0 = load i8*, i8** undef, align 8 br i1 undef, label %return, label %lor.lhs.false @@ -19,14 +19,13 @@ while.cond: ; preds = %while.body, %if.then15 %idxprom17 = sext i32 0 to i64 %arrayidx18 = getelementptr inbounds i8, i8* %0, i64 %idxprom17 - %or = or i32 undef, undef br i1 %cond1, label %if.end71, label %while.body while.body: ; preds = %while.cond br i1 %cond2, label %while.cond, label %if.then45 if.then45: ; preds = %while.body - %idxprom48139 = zext i32 %or to i64 + %idxprom48139 = zext i32 %offset to i64 %arrayidx49 = getelementptr inbounds i8, i8* %0, i64 %idxprom48139 %1 = bitcast i8* %arrayidx49 to i16* %2 = bitcast i8* %arrayidx18 to i16* Index: test/CodeGen/PowerPC/vsx-infl-copy1.ll =================================================================== --- test/CodeGen/PowerPC/vsx-infl-copy1.ll +++ test/CodeGen/PowerPC/vsx-infl-copy1.ll @@ -6,7 +6,7 @@ @uc = external global [1024 x i32], align 4 ; Function Attrs: noinline nounwind -define void @_Z8example9Pj() #0 { +define <4 x i32> @_Z8example9Pj(<4 x i32>* %addr1, i64 %input1, i64 %input2) #0 { entry: br label %vector.body @@ -31,7 +31,7 @@ %0 = getelementptr [1024 x i32], [1024 x i32]* @ub, i64 0, i64 %.sum82 %1 = bitcast i32* %0 to <4 x i32>* %wide.load36 = load <4 x i32>, <4 x i32>* %1, align 4 - %wide.load37 = load <4 x i32>, <4 x i32>* undef, align 4 + %wide.load37 = load <4 x i32>, <4 x i32>* %addr1, align 4 %.sum84 = add i64 %index, 32 %2 = getelementptr [1024 x i32], [1024 x i32]* @ub, i64 0, i64 %.sum84 %3 = bitcast i32* %2 to <4 x i32>* @@ -40,7 +40,7 @@ %4 = getelementptr [1024 x i32], [1024 x i32]* @ub, i64 0, i64 %.sum85 %5 = bitcast i32* %4 to <4 x i32>* %wide.load39 = load <4 x i32>, <4 x i32>* %5, align 4 - %6 = getelementptr [1024 x i32], [1024 x i32]* @ub, i64 0, i64 undef + %6 = getelementptr [1024 x i32], [1024 x i32]* @ub, i64 0, i64 %input1 %7 = bitcast i32* %6 to <4 x i32>* %wide.load40 = load <4 x i32>, <4 x i32>* %7, align 4 %.sum87 = add i64 %index, 44 @@ -66,7 +66,7 @@ %18 = getelementptr [1024 x i32], [1024 x i32]* @uc, i64 0, i64 %.sum95 %19 = bitcast i32* %18 to <4 x i32>* %wide.load47 = load <4 x i32>, <4 x i32>* %19, align 4 - %20 = getelementptr [1024 x i32], [1024 x i32]* @uc, i64 0, i64 undef + %20 = getelementptr [1024 x i32], [1024 x i32]* @uc, i64 0, i64 %input2 %21 = bitcast i32* %20 to <4 x i32>* %wide.load48 = load <4 x i32>, <4 x i32>* %21, align 4 %.sum97 = add i64 %index, 28 @@ -126,7 +126,16 @@ %.lcssa103 = phi <4 x i32> [ %45, %vector.body ] %.lcssa102 = phi <4 x i32> [ %44, %vector.body ] %.lcssa = phi <4 x i32> [ %43, %vector.body ] - ret void + %54 = add <4 x i32> %.lcssa112, %.lcssa111 + %55 = add <4 x i32> %.lcssa110, %54 + %56 = add <4 x i32> %.lcssa109, %55 + %57 = add <4 x i32> %.lcssa108, %56 + %58 = add <4 x i32> %.lcssa107, %57 + %59 = add <4 x i32> %.lcssa106, %58 + %60 = add <4 x i32> %.lcssa105, %59 + %61 = add <4 x i32> %.lcssa103, %60 + %62 = add <4 x i32> %.lcssa102, %61 + ret <4 x i32> %62 } attributes #0 = { noinline nounwind } Index: test/CodeGen/PowerPC/xvcmpeqdp-v2f64.ll =================================================================== --- test/CodeGen/PowerPC/xvcmpeqdp-v2f64.ll +++ test/CodeGen/PowerPC/xvcmpeqdp-v2f64.ll @@ -3,22 +3,24 @@ target triple = "powerpc64le-unknown-linux-gnu" ; Function Attrs: nounwind -define void @__fmax_double3_3D_exec() #0 { +define void @__fmax_double3_3D_exec(<3 x double> %input1, <3 x i64> %input2, + <3 x i1> %input3, <3 x i64> %input4, + <3 x i64> %input5, <4 x double>* %input6) #0 { entry: br i1 undef, label %if.then.i, label %fmax_double3.exit if.then.i: ; preds = %entry - %cmp24.i.i = fcmp ord <3 x double> undef, zeroinitializer + %cmp24.i.i = fcmp ord <3 x double> %input1, zeroinitializer %sext25.i.i = sext <3 x i1> %cmp24.i.i to <3 x i64> %neg.i.i = xor <3 x i64> %sext25.i.i, - %or.i.i = or <3 x i64> undef, %neg.i.i - %neg.i.i.i = select <3 x i1> undef, <3 x i64> zeroinitializer, <3 x i64> %sext25.i.i - %and.i.i.i = and <3 x i64> undef, %neg.i.i.i - %and26.i.i.i = and <3 x i64> undef, %or.i.i + %or.i.i = or <3 x i64> %input2, %neg.i.i + %neg.i.i.i = select <3 x i1> %input3, <3 x i64> zeroinitializer, <3 x i64> %sext25.i.i + %and.i.i.i = and <3 x i64> %input4, %neg.i.i.i + %and26.i.i.i = and <3 x i64> %input5, %or.i.i %or.i.i.i = or <3 x i64> %and.i.i.i, %and26.i.i.i %astype32.i.i.i = bitcast <3 x i64> %or.i.i.i to <3 x double> %extractVec33.i.i.i = shufflevector <3 x double> %astype32.i.i.i, <3 x double> undef, <4 x i32> - store <4 x double> %extractVec33.i.i.i, <4 x double>* undef, align 32 + store <4 x double> %extractVec33.i.i.i, <4 x double>* %input6, align 32 br label %fmax_double3.exit ; CHECK-LABEL: @__fmax_double3_3D_exec