xref: /llvm-project/polly/test/CodeGen/invariant_load_not_executed_but_in_parameters.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1; RUN: opt %loadNPMPolly -passes=polly-codegen -polly-invariant-load-hoisting=true -disable-output < %s
2;
3; Check that this does not crash as the invariant load is not executed (thus
4; not preloaded) but still referenced by one of the parameters.
5;
6target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
7
8%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 }
9%struct.Exp_.200.244.354 = type { i32, i32, i32, i32, ptr }
10%struct.Id.199.243.353 = type { ptr, i32, i32, i32, %union.anon.1.198.242.352 }
11%union.anon.1.198.242.352 = type { [2 x i64] }
12%union.anon.2.201.245.355 = type { ptr }
13%union.anon.3.202.246.356 = type { i32 }
14%union.anon.4.203.247.357 = type { ptr }
15%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 }
16%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] }
17%struct._IO_marker.205.249.359 = type { ptr, ptr, i32 }
18%struct.ClassVersion.207.251.361 = type { i16, i16 }
19%struct.ConstPool.210.254.364 = type { i16, ptr }
20%struct.cp_info.209.253.363 = type { i8, %union.anon.208.252.362 }
21%union.anon.208.252.362 = type { i64 }
22%struct.AccessFlags.211.255.365 = type { i16 }
23%struct.field_info.212.256.366 = type <{ %struct.AccessFlags.211.255.365, [6 x i8], ptr, ptr, i32, i16, [2 x i8] }>
24%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 }
25%struct.Block.214.258.368 = type { i32, i16, i16, %union.anon.0.213.257.367, i16, ptr }
26%union.anon.0.213.257.367 = type { i32 }
27%struct.LineNumberTableEntry.215.259.369 = type { i16, i16 }
28%struct.LocalVariableTableEntry.216.260.370 = type { i16, i16, i16, i16, i16 }
29%struct.Case.219.263.373 = type { i64, i64 }
30
31@currpc = external global i32, align 4
32@bufflength = external global i32, align 4
33@inbuff = external global ptr, align 8
34@stkptr = external global ptr, align 8
35@donestkptr = external global ptr, align 8
36
37; Function Attrs: uwtable
38define i32 @_Z13dotableswitchP9Classfile(ptr %c) #0 personality ptr @__gxx_personality_v0 {
39entry:
40  br label %entry.split
41
42entry.split:                                      ; preds = %entry
43  %sub = add i32 0, -1
44  %tobool.5 = icmp eq i32 0, 0
45  br i1 %tobool.5, label %while.end, label %while.body.lr.ph
46
47while.body.lr.ph:                                 ; preds = %entry.split
48  br label %while.body
49
50while.body:                                       ; preds = %while.body, %while.body.lr.ph
51  %0 = load i32, ptr @currpc, align 4
52  %rem = and i32 %0, 3
53  %tobool = icmp eq i32 %rem, 0
54  br i1 %tobool, label %while.cond.while.end_crit_edge, label %while.body
55
56while.cond.while.end_crit_edge:                   ; preds = %while.body
57  br label %while.end
58
59while.end:                                        ; preds = %while.cond.while.end_crit_edge, %entry.split
60  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)
61          to label %invoke.cont unwind label %lpad
62
63invoke.cont:                                      ; preds = %while.end
64  br i1 undef, label %for.end, label %for.body.lr.ph
65
66for.body.lr.ph:                                   ; preds = %invoke.cont
67  br label %for.body
68
69for.body:                                         ; preds = %for.body, %for.body.lr.ph
70  br i1 undef, label %for.cond.for.end_crit_edge, label %for.body
71
72lpad:                                             ; preds = %while.end
73  %1 = landingpad { ptr, i32 }
74          cleanup
75  resume { ptr, i32 } undef
76
77for.cond.for.end_crit_edge:                       ; preds = %for.body
78  br label %for.end
79
80for.end:                                          ; preds = %for.cond.for.end_crit_edge, %invoke.cont
81  ret i32 0
82}
83
84; Function Attrs: nounwind readnone
85declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #1
86
87; Function Attrs: nobuiltin
88declare noalias ptr @_Znam(i64) #2
89
90; Function Attrs: nobuiltin
91declare noalias ptr @_Znwm(i64) #2
92
93; Function Attrs: uwtable
94declare void @_ZN3ExpC2Ejj7Exptype4Type2OpPS_jjP4Case(ptr, i32, i32, i32, i32, i32, ptr, i32, i32, ptr) unnamed_addr #0 align 2
95
96declare i32 @__gxx_personality_v0(...)
97
98; Function Attrs: nobuiltin nounwind
99declare void @_ZdlPv(ptr) #3
100
101; Function Attrs: uwtable
102declare i32 @_Z10doluswitchP9Classfile(ptr) #0
103
104; Function Attrs: nounwind uwtable
105declare void @_ZN4Exp_C2E7Exptype4Type2Op(ptr, i32, i32, i32) unnamed_addr #4 align 2
106
107attributes #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" }
108attributes #1 = { nounwind readnone }
109attributes #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" }
110attributes #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" }
111attributes #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" }
112
113!llvm.ident = !{!0}
114
115!0 = !{!"clang version 3.8.0"}
116