1*e1f056f6Srahulana-quic; RUN: opt %loadNPMPolly -passes=polly-codegen -polly-invariant-load-hoisting=true -disable-output < %s 235f70200SMichael Kruse; 335f70200SMichael Kruse; Check that this does not crash as the invariant load is not executed (thus 435f70200SMichael Kruse; not preloaded) but still referenced by one of the parameters. 535f70200SMichael Kruse; 635f70200SMichael Krusetarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 735f70200SMichael Kruse 8b332499aSNikita Popov%struct.Exp.204.248.358 = type { ptr, i32, i32, i32, ptr, ptr, %union.anon.2.201.245.355, %union.anon.3.202.246.356, %union.anon.4.203.247.357 } 9b332499aSNikita Popov%struct.Exp_.200.244.354 = type { i32, i32, i32, i32, ptr } 10b332499aSNikita Popov%struct.Id.199.243.353 = type { ptr, i32, i32, i32, %union.anon.1.198.242.352 } 1135f70200SMichael Kruse%union.anon.1.198.242.352 = type { [2 x i64] } 12b332499aSNikita Popov%union.anon.2.201.245.355 = type { ptr } 1335f70200SMichael Kruse%union.anon.3.202.246.356 = type { i32 } 14b332499aSNikita Popov%union.anon.4.203.247.357 = type { ptr } 15b332499aSNikita Popov%struct.Classfile.218.262.372 = type { ptr, ptr, i32, i32, i32, %struct.ClassVersion.207.251.361, %struct.ConstPool.210.254.364, %struct.AccessFlags.211.255.365, i16, ptr, ptr, i16, ptr, i16, ptr, i16, ptr, i16, ptr, ptr, i16, ptr, ptr } 16b332499aSNikita Popov%struct._IO_FILE.206.250.360 = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] } 17b332499aSNikita Popov%struct._IO_marker.205.249.359 = type { ptr, ptr, i32 } 1835f70200SMichael Kruse%struct.ClassVersion.207.251.361 = type { i16, i16 } 19b332499aSNikita Popov%struct.ConstPool.210.254.364 = type { i16, ptr } 2035f70200SMichael Kruse%struct.cp_info.209.253.363 = type { i8, %union.anon.208.252.362 } 2135f70200SMichael Kruse%union.anon.208.252.362 = type { i64 } 2235f70200SMichael Kruse%struct.AccessFlags.211.255.365 = type { i16 } 23b332499aSNikita Popov%struct.field_info.212.256.366 = type <{ %struct.AccessFlags.211.255.365, [6 x i8], ptr, ptr, i32, i16, [2 x i8] }> 24b332499aSNikita Popov%struct.method_info.217.261.371 = type { %struct.AccessFlags.211.255.365, ptr, ptr, i8, i8, i32, ptr, i16, ptr, i16, ptr, i16, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr } 25b332499aSNikita Popov%struct.Block.214.258.368 = type { i32, i16, i16, %union.anon.0.213.257.367, i16, ptr } 2635f70200SMichael Kruse%union.anon.0.213.257.367 = type { i32 } 2735f70200SMichael Kruse%struct.LineNumberTableEntry.215.259.369 = type { i16, i16 } 2835f70200SMichael Kruse%struct.LocalVariableTableEntry.216.260.370 = type { i16, i16, i16, i16, i16 } 2935f70200SMichael Kruse%struct.Case.219.263.373 = type { i64, i64 } 3035f70200SMichael Kruse 3135f70200SMichael Kruse@currpc = external global i32, align 4 3235f70200SMichael Kruse@bufflength = external global i32, align 4 33b332499aSNikita Popov@inbuff = external global ptr, align 8 34b332499aSNikita Popov@stkptr = external global ptr, align 8 35b332499aSNikita Popov@donestkptr = external global ptr, align 8 3635f70200SMichael Kruse 3735f70200SMichael Kruse; Function Attrs: uwtable 38b332499aSNikita Popovdefine i32 @_Z13dotableswitchP9Classfile(ptr %c) #0 personality ptr @__gxx_personality_v0 { 3935f70200SMichael Kruseentry: 4035f70200SMichael Kruse br label %entry.split 4135f70200SMichael Kruse 4235f70200SMichael Kruseentry.split: ; preds = %entry 4335f70200SMichael Kruse %sub = add i32 0, -1 4435f70200SMichael Kruse %tobool.5 = icmp eq i32 0, 0 4535f70200SMichael Kruse br i1 %tobool.5, label %while.end, label %while.body.lr.ph 4635f70200SMichael Kruse 4735f70200SMichael Krusewhile.body.lr.ph: ; preds = %entry.split 4835f70200SMichael Kruse br label %while.body 4935f70200SMichael Kruse 5035f70200SMichael Krusewhile.body: ; preds = %while.body, %while.body.lr.ph 51b332499aSNikita Popov %0 = load i32, ptr @currpc, align 4 5235f70200SMichael Kruse %rem = and i32 %0, 3 5335f70200SMichael Kruse %tobool = icmp eq i32 %rem, 0 5435f70200SMichael Kruse br i1 %tobool, label %while.cond.while.end_crit_edge, label %while.body 5535f70200SMichael Kruse 5635f70200SMichael Krusewhile.cond.while.end_crit_edge: ; preds = %while.body 5735f70200SMichael Kruse br label %while.end 5835f70200SMichael Kruse 5935f70200SMichael Krusewhile.end: ; preds = %while.cond.while.end_crit_edge, %entry.split 60b332499aSNikita Popov invoke void @_ZN3ExpC2Ejj7Exptype4Type2OpPS_jjP4Case(ptr nonnull undef, i32 %sub, i32 undef, i32 9, i32 0, i32 39, ptr undef, i32 undef, i32 undef, ptr nonnull undef) 6135f70200SMichael Kruse to label %invoke.cont unwind label %lpad 6235f70200SMichael Kruse 6335f70200SMichael Kruseinvoke.cont: ; preds = %while.end 6435f70200SMichael Kruse br i1 undef, label %for.end, label %for.body.lr.ph 6535f70200SMichael Kruse 6635f70200SMichael Krusefor.body.lr.ph: ; preds = %invoke.cont 6735f70200SMichael Kruse br label %for.body 6835f70200SMichael Kruse 6935f70200SMichael Krusefor.body: ; preds = %for.body, %for.body.lr.ph 7035f70200SMichael Kruse br i1 undef, label %for.cond.for.end_crit_edge, label %for.body 7135f70200SMichael Kruse 7235f70200SMichael Kruselpad: ; preds = %while.end 73b332499aSNikita Popov %1 = landingpad { ptr, i32 } 7435f70200SMichael Kruse cleanup 75b332499aSNikita Popov resume { ptr, i32 } undef 7635f70200SMichael Kruse 7735f70200SMichael Krusefor.cond.for.end_crit_edge: ; preds = %for.body 7835f70200SMichael Kruse br label %for.end 7935f70200SMichael Kruse 8035f70200SMichael Krusefor.end: ; preds = %for.cond.for.end_crit_edge, %invoke.cont 8135f70200SMichael Kruse ret i32 0 8235f70200SMichael Kruse} 8335f70200SMichael Kruse 8435f70200SMichael Kruse; Function Attrs: nounwind readnone 8535f70200SMichael Krusedeclare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #1 8635f70200SMichael Kruse 8735f70200SMichael Kruse; Function Attrs: nobuiltin 88b332499aSNikita Popovdeclare noalias ptr @_Znam(i64) #2 8935f70200SMichael Kruse 9035f70200SMichael Kruse; Function Attrs: nobuiltin 91b332499aSNikita Popovdeclare noalias ptr @_Znwm(i64) #2 9235f70200SMichael Kruse 9335f70200SMichael Kruse; Function Attrs: uwtable 94b332499aSNikita Popovdeclare void @_ZN3ExpC2Ejj7Exptype4Type2OpPS_jjP4Case(ptr, i32, i32, i32, i32, i32, ptr, i32, i32, ptr) unnamed_addr #0 align 2 9535f70200SMichael Kruse 9635f70200SMichael Krusedeclare i32 @__gxx_personality_v0(...) 9735f70200SMichael Kruse 9835f70200SMichael Kruse; Function Attrs: nobuiltin nounwind 99b332499aSNikita Popovdeclare void @_ZdlPv(ptr) #3 10035f70200SMichael Kruse 10135f70200SMichael Kruse; Function Attrs: uwtable 102b332499aSNikita Popovdeclare i32 @_Z10doluswitchP9Classfile(ptr) #0 10335f70200SMichael Kruse 10435f70200SMichael Kruse; Function Attrs: nounwind uwtable 105b332499aSNikita Popovdeclare void @_ZN4Exp_C2E7Exptype4Type2Op(ptr, i32, i32, i32) unnamed_addr #4 align 2 10635f70200SMichael Kruse 10735f70200SMichael Kruseattributes #0 = { uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 10835f70200SMichael Kruseattributes #1 = { nounwind readnone } 10935f70200SMichael Kruseattributes #2 = { nobuiltin "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 11035f70200SMichael Kruseattributes #3 = { nobuiltin nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 11135f70200SMichael Kruseattributes #4 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 11235f70200SMichael Kruse 11335f70200SMichael Kruse!llvm.ident = !{!0} 11435f70200SMichael Kruse 11535f70200SMichael Kruse!0 = !{!"clang version 3.8.0"} 116