xref: /llvm-project/polly/test/CodeGen/invariant_verify_function_failed.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1; RUN: opt %loadNPMPolly '-passes=print<polly-detect>,scop(polly-codegen)' -polly-invariant-load-hoisting=true -disable-output < %s 2>&1 | FileCheck %s
2;
3; This crashed at some point as the pointer returned by the call
4; to @__errno_location is invariant and defined in the SCoP but not
5; loaded. Therefore it is not hoisted and consequently not available
6; at the beginning of the SCoP where we would need it if we would try
7; to hoist %tmp. We don't try to hoist %tmp anymore but this test still
8; checks that this passes to code generation and produces valid code.
9;
10; This SCoP is currently rejected because %call9 is not considered a valid
11; base pointer.
12;
13; CHECK-NOT: Valid Region for Scop
14;
15target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
16
17; Function Attrs: nounwind uwtable
18define void @fileblobSetFilename() #0 {
19entry:
20  br i1 undef, label %if.end, label %cleanup
21
22if.end:                                           ; preds = %entry
23  br i1 undef, label %land.lhs.true, label %if.end.18
24
25land.lhs.true:                                    ; preds = %if.end
26  %call9 = tail call ptr @__errno_location() #2
27  %tmp = load i32, ptr %call9, align 4, !tbaa !1
28  br i1 false, label %if.then.12, label %if.end.18
29
30if.then.12:                                       ; preds = %land.lhs.true
31  br label %if.end.18
32
33if.end.18:                                        ; preds = %if.then.12, %land.lhs.true, %if.end
34  %fd.0 = phi i32 [ undef, %if.then.12 ], [ undef, %land.lhs.true ], [ undef, %if.end ]
35  br i1 undef, label %if.then.21, label %if.end.27
36
37if.then.21:                                       ; preds = %if.end.18
38  unreachable
39
40if.end.27:                                        ; preds = %if.end.18
41  br label %cleanup
42
43cleanup:                                          ; preds = %if.end.27, %entry
44  ret void
45}
46
47; Function Attrs: nounwind readnone
48declare ptr @__errno_location() #1
49
50attributes #0 = { 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"="+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
51attributes #1 = { nounwind readnone "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"="+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
52attributes #2 = { nounwind readnone }
53
54!llvm.ident = !{!0}
55
56!0 = !{!"clang version 3.8.0 (trunk 250010) (llvm/trunk 250018)"}
57!1 = !{!2, !2, i64 0}
58!2 = !{!"int", !3, i64 0}
59!3 = !{!"omnipotent char", !4, i64 0}
60!4 = !{!"Simple C/C++ TBAA"}
61