llvm.org GIT mirror llvm / 6df50f4
IR: Support parsing numeric block ids, and emit them in textual output. Just as as llvm IR supports explicitly specifying numeric value ids for instructions, and emits them by default in textual output, now do the same for blocks. This is a slightly incompatible change in the textual IR format. Previously, llvm would parse numeric labels as string names. E.g. define void @f() { br label %"55" 55: ret void } defined a label *named* "55", even without needing to be quoted, while the reference required quoting. Now, if you intend a block label which looks like a value number to be a name, you must quote it in the definition too (e.g. `"55":`). Previously, llvm would print nameless blocks only as a comment, and would omit it if there was no predecessor. This could cause confusion for readers of the IR, just as unnamed instructions did prior to the addition of "%5 = " syntax, back in 2008 (PR2480). Now, it will always print a label for an unnamed block, with the exception of the entry block. (IMO it may be better to print it for the entry-block as well. However, that requires updating many more tests.) Thus, the following is supported, and is the canonical printing: define i32 @f(i32, i32) { %3 = add i32 %0, %1 br label %4 4: ret i32 %3 } New test cases covering this behavior are added, and other tests updated as required. Differential Revision: https://reviews.llvm.org/D58548 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356789 91177308-0d34-0410-b5e6-96231b3b80d8 James Y Knight 6 months ago
36 changed file(s) with 432 addition(s) and 346 deletion(s). Raw diff Collapse all Expand all
740740 Flow Graph) for the function. Each basic block may optionally start with a label
741741 (giving the basic block a symbol table entry), contains a list of instructions,
742742 and ends with a :ref:`terminator ` instruction (such as a branch or
743 function return). If an explicit label is not provided, a block is assigned an
744 implicit numbered label, using the next value from the same counter as used for
745 unnamed temporaries (:ref:`see above`). For example, if a function
746 entry block does not have an explicit label, it will be assigned label "%0",
747 then the first unnamed temporary in that block will be "%1", etc.
743 function return). If an explicit label name is not provided, a block is assigned
744 an implicit numbered label, using the next value from the same counter as used
745 for unnamed temporaries (:ref:`see above`). For example, if a
746 function entry block does not have an explicit label, it will be assigned label
747 "%0", then the first unnamed temporary in that block will be "%1", etc. If a
748 numeric label is explicitly specified, it must match the numeric label that
749 would be used implicitly.
748750
749751 The first basic block in a function is special in two ways: it is
750752 immediately executed on entrance to the function, and it is not allowed
10471047 for (; isdigit(static_cast(CurPtr[0])); ++CurPtr)
10481048 /*empty*/;
10491049
1050 // Check to see if this really is a label afterall, e.g. "-1:".
1050 // Check if this is a fully-numeric label:
1051 if (isdigit(TokStart[0]) && CurPtr[0] == ':') {
1052 uint64_t Val = atoull(TokStart, CurPtr);
1053 ++CurPtr; // Skip the colon.
1054 if ((unsigned)Val != Val)
1055 Error("invalid value number (too large)!");
1056 UIntVal = unsigned(Val);
1057 return lltok::LabelID;
1058 }
1059
1060 // Check to see if this really is a string label, e.g. "-1:".
10511061 if (isLabelChar(CurPtr[0]) || CurPtr[0] == ':') {
10521062 if (const char *End = isLabelTail(CurPtr)) {
10531063 StrVal.assign(TokStart, End-1);
29252925 /// unnamed. If there is an error, this returns null otherwise it returns
29262926 /// the block being defined.
29272927 BasicBlock *LLParser::PerFunctionState::DefineBB(const std::string &Name,
2928 LocTy Loc) {
2928 int NameID, LocTy Loc) {
29292929 BasicBlock *BB;
2930 if (Name.empty())
2930 if (Name.empty()) {
2931 if (NameID != -1 && unsigned(NameID) != NumberedVals.size()) {
2932 P.Error(Loc, "label expected to be numbered '" +
2933 Twine(NumberedVals.size()) + "'");
2934 return nullptr;
2935 }
29312936 BB = GetBB(NumberedVals.size(), Loc);
2932 else
2937 if (!BB) {
2938 P.Error(Loc, "unable to create block numbered '" +
2939 Twine(NumberedVals.size()) + "'");
2940 return nullptr;
2941 }
2942 } else {
29332943 BB = GetBB(Name, Loc);
2934 if (!BB) return nullptr; // Already diagnosed error.
2944 if (!BB) {
2945 P.Error(Loc, "unable to create block named '" + Name + "'");
2946 return nullptr;
2947 }
2948 }
29352949
29362950 // Move the block to the end of the function. Forward ref'd blocks are
29372951 // inserted wherever they happen to be referenced.
54885502 }
54895503
54905504 /// ParseBasicBlock
5491 /// ::= LabelStr? Instruction*
5505 /// ::= (LabelStr|LabelID)? Instruction*
54925506 bool LLParser::ParseBasicBlock(PerFunctionState &PFS) {
54935507 // If this basic block starts out with a name, remember it.
54945508 std::string Name;
5509 int NameID = -1;
54955510 LocTy NameLoc = Lex.getLoc();
54965511 if (Lex.getKind() == lltok::LabelStr) {
54975512 Name = Lex.getStrVal();
54985513 Lex.Lex();
5499 }
5500
5501 BasicBlock *BB = PFS.DefineBB(Name, NameLoc);
5514 } else if (Lex.getKind() == lltok::LabelID) {
5515 NameID = Lex.getUIntVal();
5516 Lex.Lex();
5517 }
5518
5519 BasicBlock *BB = PFS.DefineBB(Name, NameID, NameLoc);
55025520 if (!BB)
5503 return Error(NameLoc,
5504 "unable to create block named '" + Name + "'");
5521 return true;
55055522
55065523 std::string NameStr;
55075524
444444 /// DefineBB - Define the specified basic block, which is either named or
445445 /// unnamed. If there is an error, this returns null otherwise it returns
446446 /// the block being defined.
447 BasicBlock *DefineBB(const std::string &Name, LocTy Loc);
447 BasicBlock *DefineBB(const std::string &Name, int NameID, LocTy Loc);
448448
449449 bool resolveForwardRefBlockAddresses();
450450 };
421421 kw_varFlags,
422422
423423 // Unsigned Valued tokens (UIntVal).
424 LabelID, // 42:
424425 GlobalID, // @42
425426 LocalVarID, // %42
426427 AttrGrpID, // #42
34813481
34823482 /// printBasicBlock - This member is called for each basic block in a method.
34833483 void AssemblyWriter::printBasicBlock(const BasicBlock *BB) {
3484 bool IsEntryBlock = BB == &BB->getParent()->getEntryBlock();
34843485 if (BB->hasName()) { // Print out the label if it exists...
34853486 Out << "\n";
34863487 PrintLLVMName(Out, BB->getName(), LabelPrefix);
34873488 Out << ':';
3488 } else if (!BB->use_empty()) { // Don't print block # of no uses...
3489 Out << "\n;
3489 } else if (!IsEntryBlock) {
3490 Out << "\n";
34903491 int Slot = Machine.getLocalSlot(BB);
34913492 if (Slot != -1)
34923493 Out << Slot << ":";
34933494 else
3494 Out << "";
3495 Out << ":";
34953496 }
34963497
34973498 if (!BB->getParent()) {
34983499 Out.PadToColumn(50);
34993500 Out << "; Error: Block without parent!";
3500 } else if (BB != &BB->getParent()->getEntryBlock()) { // Not the entry block?
3501 } else if (!IsEntryBlock) {
35013502 // Output predecessors for the block.
35023503 Out.PadToColumn(50);
35033504 Out << ";";
22
33 define void @a_linear_impl_fig_1() nounwind {
44 0:
5 br label %"1"
5 br label %1
66 1:
7 br label %"2"
7 br label %2
88 2:
9 br label %"3"
9 br label %3
1010 3:
11 br i1 1, label %"13", label %"4"
11 br i1 1, label %12, label %4
1212 4:
13 br i1 1, label %"5", label %"1"
13 br i1 1, label %5, label %1
1414 5:
15 br i1 1, label %"8", label %"6"
15 br i1 1, label %8, label %6
1616 6:
17 br i1 1, label %"7", label %"4"
17 br i1 1, label %7, label %4
1818 7:
1919 ret void
2020 8:
21 br i1 1, label %"9", label %"1"
21 br i1 1, label %9, label %1
2222 9:
23 br label %"10"
23 br label %10
2424 10:
25 br i1 1, label %"12", label %"11"
25 br i1 1, label %13, label %11
2626 11:
27 br i1 1, label %"9", label %"8"
27 br i1 1, label %9, label %8
28 12:
29 br i1 1, label %2, label %1
2830 13:
29 br i1 1, label %"2", label %"1"
30 12:
31 switch i32 0, label %"1" [ i32 0, label %"9"
32 i32 1, label %"8"]
31 switch i32 0, label %1 [ i32 0, label %9
32 i32 1, label %8]
3333 }
3434
3535 ; CHECK: DominanceFrontier for function: a_linear_impl_fig_1
36 ; CHECK-DAG: DomFrontier for BB %"0" is:
37 ; CHECK-DAG: DomFrontier for BB %"11" is: %"{{[8|9]}}" %"{{[8|9]}}"
38 ; CHECK-DAG: DomFrontier for BB %"1" is: %"1"
39 ; CHECK-DAG: DomFrontier for BB %"2" is: %"{{[1|2]}}" %"{{[1|2]}}"
40 ; CHECK-DAG: DomFrontier for BB %"3" is: %"{{[1|2]}}" %"{{[1|2]}}"
41 ; CHECK-DAG: DomFrontier for BB %"13" is: %"{{[1|2]}}" %"{{[1|2]}}"
42 ; CHECK-DAG: DomFrontier for BB %"4" is: %"{{[1|4]}}" %"{{[1|4]}}"
43 ; CHECK-DAG: DomFrontier for BB %"5" is: %"{{[1|4]}}" %"{{[1|4]}}"
44 ; CHECK-DAG: DomFrontier for BB %"8" is: %"{{[1|8]}}" %"{{[1|8]}}"
45 ; CHECK-DAG: DomFrontier for BB %"6" is: %"4"
46 ; CHECK-DAG: DomFrontier for BB %"7" is:
47 ; CHECK-DAG: DomFrontier for BB %"9" is: %"{{[1|8|9]}}" %"{{[1|8|9]}}" %"{{[1|8|9]}}"
48 ; CHECK-DAG: DomFrontier for BB %"10" is: %"{{[1|8|9]}}" %"{{[1|8|9]}}" %"{{[1|8|9]}}"
49 ; CHECK-DAG: DomFrontier for BB %"12" is: %"{{[1|8|9]}}" %"{{[1|8|9]}}" %"{{[1|8|9]}}"
36 ; CHECK-DAG: DomFrontier for BB %0 is:
37 ; CHECK-DAG: DomFrontier for BB %11 is: %{{[8|9]}} %{{[8|9]}}
38 ; CHECK-DAG: DomFrontier for BB %1 is: %1
39 ; CHECK-DAG: DomFrontier for BB %2 is: %{{[1|2]}} %{{[1|2]}}
40 ; CHECK-DAG: DomFrontier for BB %3 is: %{{[1|2]}} %{{[1|2]}}
41 ; CHECK-DAG: DomFrontier for BB %12 is: %{{[1|2]}} %{{[1|2]}}
42 ; CHECK-DAG: DomFrontier for BB %4 is: %{{[1|4]}} %{{[1|4]}}
43 ; CHECK-DAG: DomFrontier for BB %5 is: %{{[1|4]}} %{{[1|4]}}
44 ; CHECK-DAG: DomFrontier for BB %8 is: %{{[1|8]}} %{{[1|8]}}
45 ; CHECK-DAG: DomFrontier for BB %6 is: %4
46 ; CHECK-DAG: DomFrontier for BB %7 is:
47 ; CHECK-DAG: DomFrontier for BB %9 is: %{{[1|8|9]}} %{{[1|8|9]}} %{{[1|8|9]}}
48 ; CHECK-DAG: DomFrontier for BB %10 is: %{{[1|8|9]}} %{{[1|8|9]}} %{{[1|8|9]}}
49 ; CHECK-DAG: DomFrontier for BB %13 is: %{{[1|8|9]}} %{{[1|8|9]}} %{{[1|8|9]}}
66 ; RUN: opt < %s -passes='print' 2>&1 | FileCheck %s
77
88 define void @normal_condition() nounwind {
9 5:
9 "5":
1010 br label %"0"
1111
12 0:
12 "0":
1313 br label %"1"
14 1:
14 "1":
1515 br i1 1, label %"2", label %"3"
16 2:
16 "2":
1717 ret void
18 3:
18 "3":
1919 br i1 1, label %"1", label %"4"
20 4:
20 "4":
2121 br label %"0"
2222 }
2323
66 ; RUN: opt < %s -passes='print' 2>&1 | FileCheck %s
77
88 define void @normal_condition() nounwind {
9 0:
9 "0":
1010 br label %"1"
11 1:
11 "1":
1212 br i1 1, label %"2", label %"3"
13 2:
13 "2":
1414 br label %"3"
15 3:
15 "3":
1616 ret void
1717 }
1818 ; CHECK-NOT: =>
66 ; RUN: opt < %s -passes='print' 2>&1 | FileCheck %s
77
88 define void @normal_condition() nounwind {
9 0:
9 "0":
1010 br i1 1, label %"1", label %"4"
1111
12 1:
12 "1":
1313 br i1 1, label %"2", label %"3"
14 2:
14 "2":
1515 br label %"4"
16 3:
16 "3":
1717 br label %"4"
18 4:
18 "4":
1919 ret void
2020 }
2121 ; CHECK-NOT: =>
66 ; RUN: opt < %s -passes='print' 2>&1 | FileCheck %s
77
88 define void @normal_condition() nounwind {
9 0:
9 "0":
1010 br label %"1"
11 1:
11 "1":
1212 br i1 1, label %"2", label %"3"
13 2:
13 "2":
1414 br label %"4"
15 3:
15 "3":
1616 br label %"4"
17 4:
17 "4":
1818 ret void
1919 }
2020
33
44 define void @normal_condition() nounwind {
55 0:
6 br label %"1"
6 br label %1
77 1:
8 br i1 1, label %"2", label %"3"
8 br i1 1, label %2, label %3
99 2:
10 br label %"2"
10 br label %2
1111 3:
12 br label %"4"
12 br label %4
1313 4:
1414 ret void
1515 }
1616 ; CHECK-NOT: =>
1717 ; CHECK: [0] 0 =>
18 ; STAT: 1 region - The # of regions
18 ; STAT: 1 region - The # of regions
44 ; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s
55
66 define void @normal_condition() nounwind {
7 0:
7 "0":
88 br label %"1"
9 1:
9 "1":
1010 br i1 1, label %"2", label %"3"
11 2:
11 "2":
1212 br label %"5"
13 5:
13 "5":
1414 br i1 1, label %"11", label %"12"
15 11:
15 "11":
1616 br label %"6"
17 12:
17 "12":
1818 br label %"6"
19 6:
19 "6":
2020 br label %"2"
21 3:
21 "3":
2222 br label %"4"
23 4:
23 "4":
2424 ret void
2525 }
2626 ; CHECK-NOT: =>
55 ; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s
66
77 define void @normal_condition() nounwind {
8 0:
8 "0":
99 br label %"7"
10 7:
10 "7":
1111 br i1 1, label %"1", label %"8"
12 1:
12 "1":
1313 br i1 1, label %"2", label %"3"
14 2:
14 "2":
1515 br label %"5"
16 5:
16 "5":
1717 br i1 1, label %"11", label %"12"
18 11:
18 "11":
1919 br label %"6"
20 12:
20 "12":
2121 br label %"6"
22 6:
22 "6":
2323 br label %"2"
24 8:
24 "8":
2525 br label %"9"
26 9:
26 "9":
2727 br i1 1, label %"13", label %"14"
28 13:
28 "13":
2929 br label %"10"
30 14:
30 "14":
3131 br label %"10"
32 10:
32 "10":
3333 br label %"8"
34 3:
34 "3":
3535 br label %"4"
36 4:
36 "4":
3737 ret void
3838 }
3939 ; CHECK-NOT: =>
44 ; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s
55
66 define void @normal_condition() nounwind {
7 0:
7 "0":
88 br label %"7"
9 7:
9 "7":
1010 br i1 1, label %"1", label %"8"
11 1:
11 "1":
1212 br i1 1, label %"2", label %"3"
13 2:
13 "2":
1414 br label %"5"
15 5:
15 "5":
1616 br i1 1, label %"11", label %"12"
17 11:
17 "11":
1818 br label %"6"
19 12:
19 "12":
2020 br label %"6"
21 6:
21 "6":
2222 br i1 1, label %"2", label %"10"
23 8:
23 "8":
2424 br label %"9"
25 9:
25 "9":
2626 br i1 1, label %"13", label %"14"
27 13:
27 "13":
2828 br label %"10"
29 14:
29 "14":
3030 br label %"10"
31 10:
31 "10":
3232 br label %"8"
33 3:
33 "3":
3434 br label %"4"
35 4:
35 "4":
3636 ret void
3737 }
3838 ; CHECK-NOT: =>
4747 ; BBIT: 5, 11, 12,
4848 ; RNIT: 0, 7, 1, 2 => 10, 10, 8, 9, 13, 14, 3, 4,
4949 ; RNIT: 2, 5 => 6, 6,
50 ; RNIT: 5, 11, 12,
50 ; RNIT: 5, 11, 12,
0 ; RUN: opt -regions -analyze < %s | FileCheck %s
11
22 define void @normal_condition() nounwind {
3 0:
3 "0":
44 br label %"7"
5 7:
5 "7":
66 br i1 1, label %"1", label %"8"
7 1:
7 "1":
88 br i1 1, label %"6", label %"3"
9 6:
9 "6":
1010 br label %"8"
11 8:
11 "8":
1212 br label %"8"
13 3:
13 "3":
1414 br label %"4"
15 4:
15 "4":
1616 ret void
1717 }
1818
0 ; RUN: opt -regions -analyze < %s | FileCheck %s
11
22 define void @normal_condition() nounwind {
3 0:
3 "0":
44 br label %"7"
5 7:
5 "7":
66 br i1 1, label %"1", label %"9"
7 9:
7 "9":
88 br label %"8"
9 1:
9 "1":
1010 br i1 1, label %"6", label %"3"
11 6:
11 "6":
1212 br label %"9"
13 8:
13 "8":
1414 br label %"8"
15 3:
15 "3":
1616 br label %"4"
17 4:
17 "4":
1818 ret void
1919 }
2020
0 ; RUN: opt -regions -analyze < %s | FileCheck %s
11
22 define void @normal_condition() nounwind {
3 0:
3 "0":
44 br label %"7"
5 7:
5 "7":
66 br i1 1, label %"1", label %"8"
7 1:
7 "1":
88 br i1 1, label %"6", label %"3"
9 6:
9 "6":
1010 br label %"8"
11 8:
11 "8":
1212 br i1 1, label %"8", label %"7"
13 3:
13 "3":
1414 br label %"4"
15 4:
15 "4":
1616 ret void
1717 }
1818
77 ; RUN: opt < %s -passes='print' 2>&1 | FileCheck %s
88
99 define void @normal_condition() nounwind {
10 0:
10 "0":
1111 br label %"1"
12 1:
12 "1":
1313 br i1 1, label %"6", label %"2"
14 2:
14 "2":
1515 br i1 1, label %"3", label %"4"
16 3:
16 "3":
1717 br label %"5"
18 4:
18 "4":
1919 br label %"5"
20 5:
20 "5":
2121 br label %"8"
22 8:
22 "8":
2323 br i1 1, label %"7", label %"9"
24 9:
24 "9":
2525 br label %"2"
26 7:
26 "7":
2727 br label %"6"
28 6:
28 "6":
2929 ret void
3030 }
3131
77 ; RUN: opt < %s -passes='print' 2>&1 | FileCheck %s
88
99 define void @a_linear_impl_fig_1() nounwind {
10 0:
10 "0":
1111
1212 br i1 1, label %"1", label %"15"
13 1:
13 "1":
1414 switch i32 0, label %"2" [ i32 0, label %"3"
1515 i32 1, label %"7"]
16 2:
16 "2":
1717 br label %"4"
18 3:
18 "3":
1919 br label %"5"
20 4:
20 "4":
2121 br label %"6"
22 5:
22 "5":
2323 br label %"6"
24 6:
24 "6":
2525 br label %"7"
26 7:
26 "7":
2727 br label %"15"
28 15:
28 "15":
2929 br label %"8"
30 8:
30 "8":
3131 br label %"16"
32 16:
32 "16":
3333 br label %"9"
34 9:
34 "9":
3535 br i1 1, label %"10", label %"11"
36 11:
36 "11":
3737 br i1 1, label %"13", label %"12"
38 13:
38 "13":
3939 br label %"14"
40 12:
40 "12":
4141 br label %"14"
42 14:
42 "14":
4343 br label %"8"
44 10:
44 "10":
4545 br label %"17"
46 17:
46 "17":
4747 br label %"18"
48 18:
48 "18":
4949 ret void
5050 }
5151
66 ; RUN: opt < %s -passes='print' 2>&1 | FileCheck %s
77
88 define void @a_linear_impl_fig_1() nounwind {
9 0:
9 "0":
1010 br label %"1"
11 1:
11 "1":
1212 br label %"2"
13 2:
13 "2":
1414 br label %"3"
15 3:
15 "3":
1616 br i1 1, label %"13", label %"4"
17 4:
17 "4":
1818 br i1 1, label %"5", label %"1"
19 5:
19 "5":
2020 br i1 1, label %"8", label %"6"
21 6:
21 "6":
2222 br i1 1, label %"7", label %"4"
23 7:
23 "7":
2424 ret void
25 8:
25 "8":
2626 br i1 1, label %"9", label %"1"
27 9:
27 "9":
2828 br label %"10"
29 10:
29 "10":
3030 br i1 1, label %"12", label %"11"
31 11:
31 "11":
3232 br i1 1, label %"9", label %"8"
33 13:
33 "13":
3434 br i1 1, label %"2", label %"1"
35 12:
35 "12":
3636 switch i32 0, label %"1" [ i32 0, label %"9"
3737 i32 1, label %"8"]
3838 }
0 ; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s --match-full-lines
1 ; RUN: verify-uselistorder %s
2
3 define i32 @test1(i32 %X) {
4 ; Implicit entry label. Not printed on output.
5 %1 = alloca i32
6 br label %2
7 ; Implicit label ids still allowed.
8 br label %3
9 3: ; Explicit numeric label
10 br label %"2"
11 "2": ; string label, quoted number
12 br label %-3
13 -3: ; numeric-looking, but actually string, label
14 br label %-N-
15 -N-:
16 br label %$N
17 $N:
18 %4 = add i32 1, 1
19 ret i32 %4
20 }
21
22 ; CHECK-LABEL: define i32 @test1(i32 %X) {
23 ; CHECK-NEXT: %1 = alloca i32
24 ; CHECK-NEXT: br label %2
25 ; CHECK: 2: ; preds = %0
26 ; CHECK-NEXT: br label %3
27 ; CHECK: 3: ; preds = %2
28 ; CHECK-NEXT: br label %"2"
29 ; CHECK: "2": ; preds = %3
30 ; CHECK-NEXT: br label %-3
31 ; CHECK: -3: ; preds = %"2"
32 ; CHECK-NEXT: br label %-N-
33 ; CHECK: -N-: ; preds = %-3
34 ; CHECK-NEXT: br label %"$N"
35 ; CHECK: "$N": ; preds = %-N-
36 ; CHECK-NEXT: %4 = add i32 1, 1
37 ; CHECK-NEXT: ret i32 %4
38 ; CHECK-NEXT: }
39
40 define void @test2(i32, i32) {
41 ; entry label id still not printed on output
42 2:
43 ret void
44 }
45
46 ; CHECK-LABEL: define void @test2(i32, i32) {
47 ; CHECK-NEXT: ret void
0 ; RUN: not llvm-as < %s 2>&1 | FileCheck %s
1
2 define void @f () {
3 1:
4 ; CHECK: error: label expected to be numbered '0'
5 ret void
6 }
44 ; CHECK: movl
55 ; CHECK: movl
66 ; CHECK: ret
7 0:
7 entry:
88 %0 = load atomic i32*, i32** %a0 seq_cst, align 4
99 ret i32* %0
1010 }
1515 ; CHECK: movl
1616 ; CHECK: xchgl
1717 ; CHECK: ret
18 0:
19 store atomic i32* %a0, i32** %a1 seq_cst, align 4
18 entry:
19 store atomic i32* %a0, i32** %a1 seq_cst, align 4
2020 ret void
2121 }
7474 %p = load <4 x float>*, <4 x float>** @v4f32, align 8
7575 ; STORE: [[MASK0:%[0-9A-Za-z]+]] = extractelement <4 x i1> %mask, i64 0
7676 ; STORE: br i1 [[MASK0]], label %[[THEN0:[0-9A-Za-z]+]], label %[[AFTER0:[0-9A-Za-z]+]]
77 ; STORE: [[THEN0]]:
77 ; STORE: [[THEN0]]:
7878 ; STORE: [[GEP0:%[0-9A-Za-z]+]] = getelementptr <4 x float>, <4 x float>* %p, i64 0, i64 0
7979 ; STORE: [[PGEP0:%[0-9A-Za-z]+]] = ptrtoint float* [[GEP0]] to i64
8080 ; STORE: call void @__asan_store4(i64 [[PGEP0]])
8181 ; STORE: br label %[[AFTER0]]
82 ; STORE:
82 ; STORE: [[AFTER0]]:
8383
8484 ; STORE: [[MASK1:%[0-9A-Za-z]+]] = extractelement <4 x i1> %mask, i64 1
8585 ; STORE: br i1 [[MASK1]], label %[[THEN1:[0-9A-Za-z]+]], label %[[AFTER1:[0-9A-Za-z]+]]
86 ; STORE: [[THEN1]]:
86 ; STORE: [[THEN1]]:
8787 ; STORE: [[GEP1:%[0-9A-Za-z]+]] = getelementptr <4 x float>, <4 x float>* %p, i64 0, i64 1
8888 ; STORE: [[PGEP1:%[0-9A-Za-z]+]] = ptrtoint float* [[GEP1]] to i64
8989 ; STORE: call void @__asan_store4(i64 [[PGEP1]])
9090 ; STORE: br label %[[AFTER1]]
91 ; STORE:
91 ; STORE: [[AFTER1]]:
9292
9393 ; STORE: [[MASK2:%[0-9A-Za-z]+]] = extractelement <4 x i1> %mask, i64 2
9494 ; STORE: br i1 [[MASK2]], label %[[THEN2:[0-9A-Za-z]+]], label %[[AFTER2:[0-9A-Za-z]+]]
95 ; STORE: [[THEN2]]:
95 ; STORE: [[THEN2]]:
9696 ; STORE: [[GEP2:%[0-9A-Za-z]+]] = getelementptr <4 x float>, <4 x float>* %p, i64 0, i64 2
9797 ; STORE: [[PGEP2:%[0-9A-Za-z]+]] = ptrtoint float* [[GEP2]] to i64
9898 ; STORE: call void @__asan_store4(i64 [[PGEP2]])
9999 ; STORE: br label %[[AFTER2]]
100 ; STORE:
100 ; STORE: [[AFTER2]]:
101101
102102 ; STORE: [[MASK3:%[0-9A-Za-z]+]] = extractelement <4 x i1> %mask, i64 3
103103 ; STORE: br i1 [[MASK3]], label %[[THEN3:[0-9A-Za-z]+]], label %[[AFTER3:[0-9A-Za-z]+]]
104 ; STORE: [[THEN3]]:
104 ; STORE: [[THEN3]]:
105105 ; STORE: [[GEP3:%[0-9A-Za-z]+]] = getelementptr <4 x float>, <4 x float>* %p, i64 0, i64 3
106106 ; STORE: [[PGEP3:%[0-9A-Za-z]+]] = ptrtoint float* [[GEP3]] to i64
107107 ; STORE: call void @__asan_store4(i64 [[PGEP3]])
108108 ; STORE: br label %[[AFTER3]]
109 ; STORE:
109 ; STORE: [[AFTER3]]:
110110
111111 ; STORE: tail call void @llvm.masked.store.v4f32.p0v4f32(<4 x float> %arg, <4 x float>* %p, i32 4, <4 x i1> %mask)
112112 tail call void @llvm.masked.store.v4f32.p0v4f32(<4 x float> %arg, <4 x float>* %p, i32 4, <4 x i1> %mask)
202202 %p = load <4 x float>*, <4 x float>** @v4f32, align 8
203203 ; LOAD: [[MASK0:%[0-9A-Za-z]+]] = extractelement <4 x i1> %mask, i64 0
204204 ; LOAD: br i1 [[MASK0]], label %[[THEN0:[0-9A-Za-z]+]], label %[[AFTER0:[0-9A-Za-z]+]]
205 ; LOAD: [[THEN0]]:
205 ; LOAD: [[THEN0]]:
206206 ; LOAD: [[GEP0:%[0-9A-Za-z]+]] = getelementptr <4 x float>, <4 x float>* %p, i64 0, i64 0
207207 ; LOAD: [[PGEP0:%[0-9A-Za-z]+]] = ptrtoint float* [[GEP0]] to i64
208208 ; LOAD: call void @__asan_load4(i64 [[PGEP0]])
209209 ; LOAD: br label %[[AFTER0]]
210 ; LOAD:
210 ; LOAD: [[AFTER0]]:
211211
212212 ; LOAD: [[MASK1:%[0-9A-Za-z]+]] = extractelement <4 x i1> %mask, i64 1
213213 ; LOAD: br i1 [[MASK1]], label %[[THEN1:[0-9A-Za-z]+]], label %[[AFTER1:[0-9A-Za-z]+]]
214 ; LOAD: [[THEN1]]:
214 ; LOAD: [[THEN1]]:
215215 ; LOAD: [[GEP1:%[0-9A-Za-z]+]] = getelementptr <4 x float>, <4 x float>* %p, i64 0, i64 1
216216 ; LOAD: [[PGEP1:%[0-9A-Za-z]+]] = ptrtoint float* [[GEP1]] to i64
217217 ; LOAD: call void @__asan_load4(i64 [[PGEP1]])
218218 ; LOAD: br label %[[AFTER1]]
219 ; LOAD:
219 ; LOAD: [[AFTER1]]:
220220
221221 ; LOAD: [[MASK2:%[0-9A-Za-z]+]] = extractelement <4 x i1> %mask, i64 2
222222 ; LOAD: br i1 [[MASK2]], label %[[THEN2:[0-9A-Za-z]+]], label %[[AFTER2:[0-9A-Za-z]+]]
223 ; LOAD: [[THEN2]]:
223 ; LOAD: [[THEN2]]:
224224 ; LOAD: [[GEP2:%[0-9A-Za-z]+]] = getelementptr <4 x float>, <4 x float>* %p, i64 0, i64 2
225225 ; LOAD: [[PGEP2:%[0-9A-Za-z]+]] = ptrtoint float* [[GEP2]] to i64
226226 ; LOAD: call void @__asan_load4(i64 [[PGEP2]])
227227 ; LOAD: br label %[[AFTER2]]
228 ; LOAD:
228 ; LOAD: [[AFTER2]]:
229229
230230 ; LOAD: [[MASK3:%[0-9A-Za-z]+]] = extractelement <4 x i1> %mask, i64 3
231231 ; LOAD: br i1 [[MASK3]], label %[[THEN3:[0-9A-Za-z]+]], label %[[AFTER3:[0-9A-Za-z]+]]
232 ; LOAD: [[THEN3]]:
232 ; LOAD: [[THEN3]]:
233233 ; LOAD: [[GEP3:%[0-9A-Za-z]+]] = getelementptr <4 x float>, <4 x float>* %p, i64 0, i64 3
234234 ; LOAD: [[PGEP3:%[0-9A-Za-z]+]] = ptrtoint float* [[GEP3]] to i64
235235 ; LOAD: call void @__asan_load4(i64 [[PGEP3]])
236236 ; LOAD: br label %[[AFTER3]]
237 ; LOAD:
237 ; LOAD: [[AFTER3]]:
238238
239239 ; LOAD: tail call <4 x float> @llvm.masked.load.v4f32.p0v4f32(<4 x float>* %p, i32 4, <4 x i1> %mask, <4 x float> %arg)
240240 %res = tail call <4 x float> @llvm.masked.load.v4f32.p0v4f32(<4 x float>* %p, i32 4, <4 x i1> %mask, <4 x float> %arg)
158158
159159 ; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 40, i8* %zz)
160160
161 ; CHECK-LABEL:
161 ; CHECK: {{^[0-9]+}}:
162162
163163 ; CHECK-NEXT: [[OFFSET:%[0-9]+]] = add i64 [[SHADOW_BASE]], 0
164164 ; CHECK-NEXT: call void @__asan_set_shadow_f5(i64 [[OFFSET]], i64 128)
165165
166166 ; CHECK-NOT: add i64 [[SHADOW_BASE]]
167167
168 ; CHECK-LABEL:
168 ; CHECK: {{^[0-9]+}}:
169169
170170 ; 00000000
171171 ; EXIT-NEXT: [[OFFSET:%[0-9]+]] = add i64 [[SHADOW_BASE]], 0
204204 ; CHECK-NOT: add i64 [[SHADOW_BASE]]
205205
206206 ret void
207 ; CHECK-LABEL:
207 ; CHECK: {{^[0-9]+}}:
208208 ; CHECK: ret void
209209 }
210210
158158
159159 ; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 40, i8* %zz)
160160
161 ; CHECK-LABEL:
161 ; CHECK: {{^[0-9]+}}:
162162
163163 ; CHECK-NEXT: [[OFFSET:%[0-9]+]] = add i64 [[SHADOW_BASE]], 0
164164 ; CHECK-NEXT: call void @__asan_set_shadow_f5(i64 [[OFFSET]], i64 128)
165165
166166 ; CHECK-NOT: add i64 [[SHADOW_BASE]]
167167
168 ; CHECK-LABEL:
168 ; CHECK: {{^[0-9]+}}:
169169
170170 ; 00000000
171171 ; EXIT-NEXT: [[OFFSET:%[0-9]+]] = add i64 [[SHADOW_BASE]], 0
204204 ; CHECK-NOT: add i64 [[SHADOW_BASE]]
205205
206206 ret void
207 ; CHECK-LABEL:
207 ; CHECK: {{^[0-9]+}}:
208208 ; CHECK: ret void
209209 }
210210
1111 ; CHECK: entry:
1212 ; CHECK: load i32, i32* @__asan_option_detect_stack_use_after_return
1313
14 ; CHECK:
14 ; CHECK: [[UAR_ENABLED_BB:^[0-9]+]]:
1515 ; CHECK: [[FAKE_STACK_RT:%[0-9]+]] = call i64 @__asan_stack_malloc_
1616
17 ; CHECK:
17 ; CHECK: [[FAKE_STACK_BB:^[0-9]+]]:
1818 ; CHECK: [[FAKE_STACK:%[0-9]+]] = phi i64 [ 0, %entry ], [ [[FAKE_STACK_RT]], %[[UAR_ENABLED_BB]] ]
1919 ; CHECK: icmp eq i64 [[FAKE_STACK]], 0
2020
21 ; CHECK:
21 ; CHECK: [[NO_FAKE_STACK_BB:^[0-9]+]]:
2222 ; CHECK: %MyAlloca = alloca i8, i64
2323 ; CHECK: [[ALLOCA:%[0-9]+]] = ptrtoint i8* %MyAlloca
2424
4343 ; CHECK-NOT: xor
4444 ; CHECK: icmp
4545 ; CHECK: br i1
46 ; CHECK:
46 ; CHECK: {{^[0-9]+}}:
4747 ; CHECK: call void @__msan_warning_noreturn
48 ; CHECK:
48 ; CHECK: {{^[0-9]+}}:
4949 ; CHECK: xor
5050 ; CHECK: store
5151 ; CHECK: store i32 %x
3838 ; CHECK: store
3939 ; CHECK-ORIGINS: icmp
4040 ; CHECK-ORIGINS: br i1
41 ; CHECK-ORIGINS:
41 ; CHECK-ORIGINS: {{^[0-9]+}}:
4242 ; CHECK-ORIGINS: store
4343 ; CHECK-ORIGINS: br label
44 ; CHECK-ORIGINS:
44 ; CHECK-ORIGINS: {{^[0-9]+}}:
4545 ; CHECK: store
4646 ; CHECK: ret void
4747
6262 ; CHECK: store {{.*}} align 32
6363 ; CHECK-ORIGINS: icmp
6464 ; CHECK-ORIGINS: br i1
65 ; CHECK-ORIGINS:
65 ; CHECK-ORIGINS: {{^[0-9]+}}:
6666 ; CHECK-ORIGINS: store {{.*}} align 32
6767 ; CHECK-ORIGINS: br label
68 ; CHECK-ORIGINS:
68 ; CHECK-ORIGINS: {{^[0-9]+}}:
6969 ; CHECK: store {{.*}} align 32
7070 ; CHECK: ret void
7171
3939 }
4040
4141 ; CHECK-LABEL: @Store1
42 ; CHECK-LABEL: entry:
43 ; CHECK: @__msan_get_context_state()
44 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
45 ; CHECK-LABEL: entry.split:
42 ; CHECK: entry:
43 ; CHECK: @__msan_get_context_state()
44 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
45 ; CHECK: entry.split:
4646 ; CHECK: [[BASE2:%[0-9]+]] = ptrtoint {{.*}} [[PARAM_SHADOW]]
4747 ; CHECK: [[BASE:%[0-9]+]] = ptrtoint {{.*}} [[PARAM_SHADOW]]
4848 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = inttoptr {{.*}} [[BASE]]
5050 ; CHECK: load i64, i64* [[SHADOW]]
5151 ; CHECK: icmp
5252 ; CHECK: br i1
53 ; CHECK-LABEL:
53 ; CHECK: {{^[0-9]+}}:
5454 ; CHECK: @__msan_metadata_ptr_for_store_1(i8* %p)
5555 ; CHECK: store i8
5656 ; If the new shadow is non-zero, jump to __msan_chain_origin()
5757 ; CHECK: icmp
5858 ; CHECK: br i1
59 ; CHECK:
59 ; CHECK: {{^[0-9]+}}:
6060 ; CHECK: @__msan_chain_origin
6161 ; Storing origin here:
6262 ; CHECK: store i32
6363 ; CHECK: br label
64 ; CHECK:
64 ; CHECK: {{^[0-9]+}}:
6565 ; CHECK: store i8
6666 ; CHECK: ret void
6767
7272 }
7373
7474 ; CHECK-LABEL: @Store2
75 ; CHECK-LABEL: entry:
76 ; CHECK: @__msan_get_context_state()
77 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
78 ; CHECK-LABEL: entry.split:
79 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
80 ; Load the shadow of %p and check it
81 ; CHECK: load i64
82 ; CHECK: icmp
83 ; CHECK: br i1
84 ; CHECK-LABEL:
75 ; CHECK: entry:
76 ; CHECK: @__msan_get_context_state()
77 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
78 ; CHECK: entry.split:
79 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
80 ; Load the shadow of %p and check it
81 ; CHECK: load i64
82 ; CHECK: icmp
83 ; CHECK: br i1
84 ; CHECK: {{^[0-9]+}}:
8585 ; CHECK: [[REG:%[0-9]+]] = bitcast i16* %p to i8*
8686 ; CHECK: @__msan_metadata_ptr_for_store_2(i8* [[REG]])
8787 ; CHECK: store i16
8888 ; If the new shadow is non-zero, jump to __msan_chain_origin()
8989 ; CHECK: icmp
9090 ; CHECK: br i1
91 ; CHECK:
91 ; CHECK: {{^[0-9]+}}:
9292 ; CHECK: @__msan_chain_origin
9393 ; Storing origin here:
9494 ; CHECK: store i32
9595 ; CHECK: br label
96 ; CHECK:
96 ; CHECK: {{^[0-9]+}}:
9797 ; CHECK: store i16
9898 ; CHECK: ret void
9999
105105 }
106106
107107 ; CHECK-LABEL: @Store4
108 ; CHECK-LABEL: entry:
109 ; CHECK: @__msan_get_context_state()
110 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
111 ; CHECK-LABEL: entry.split:
112 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
113 ; Load the shadow of %p and check it
114 ; CHECK: load i32
115 ; CHECK: icmp
116 ; CHECK: br i1
117 ; CHECK-LABEL:
108 ; CHECK: entry:
109 ; CHECK: @__msan_get_context_state()
110 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
111 ; CHECK: entry.split:
112 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
113 ; Load the shadow of %p and check it
114 ; CHECK: load i32
115 ; CHECK: icmp
116 ; CHECK: br i1
117 ; CHECK: {{^[0-9]+}}:
118118 ; CHECK: [[REG:%[0-9]+]] = bitcast i32* %p to i8*
119119 ; CHECK: @__msan_metadata_ptr_for_store_4(i8* [[REG]])
120120 ; CHECK: store i32
121121 ; If the new shadow is non-zero, jump to __msan_chain_origin()
122122 ; CHECK: icmp
123123 ; CHECK: br i1
124 ; CHECK:
124 ; CHECK: {{^[0-9]+}}:
125125 ; CHECK: @__msan_chain_origin
126126 ; Storing origin here:
127127 ; CHECK: store i32
128128 ; CHECK: br label
129 ; CHECK:
129 ; CHECK: {{^[0-9]+}}:
130130 ; CHECK: store i32
131131 ; CHECK: ret void
132132
137137 }
138138
139139 ; CHECK-LABEL: @Store8
140 ; CHECK-LABEL: entry:
141 ; CHECK: @__msan_get_context_state()
142 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
143 ; CHECK-LABEL: entry.split:
144 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
145 ; Load the shadow of %p and check it
146 ; CHECK: load i64
147 ; CHECK: icmp
148 ; CHECK: br i1
149 ; CHECK-LABEL:
140 ; CHECK: entry:
141 ; CHECK: @__msan_get_context_state()
142 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
143 ; CHECK: entry.split:
144 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
145 ; Load the shadow of %p and check it
146 ; CHECK: load i64
147 ; CHECK: icmp
148 ; CHECK: br i1
149 ; CHECK: {{^[0-9]+}}:
150150 ; CHECK: [[REG:%[0-9]+]] = bitcast i64* %p to i8*
151151 ; CHECK: @__msan_metadata_ptr_for_store_8(i8* [[REG]])
152152 ; CHECK: store i64
153153 ; If the new shadow is non-zero, jump to __msan_chain_origin()
154154 ; CHECK: icmp
155155 ; CHECK: br i1
156 ; CHECK:
156 ; CHECK: {{^[0-9]+}}:
157157 ; CHECK: @__msan_chain_origin
158158 ; Storing origin here:
159159 ; CHECK: store i32
160160 ; CHECK: br label
161 ; CHECK:
161 ; CHECK: {{^[0-9]+}}:
162162 ; CHECK: store i64
163163 ; CHECK: ret void
164164
169169 }
170170
171171 ; CHECK-LABEL: @Store16
172 ; CHECK-LABEL: entry:
173 ; CHECK: @__msan_get_context_state()
174 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
175 ; CHECK-LABEL: entry.split:
176 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
177 ; Load the shadow of %p and check it
178 ; CHECK: load i64
179 ; CHECK: icmp
180 ; CHECK: br i1
181 ; CHECK-LABEL:
172 ; CHECK: entry:
173 ; CHECK: @__msan_get_context_state()
174 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
175 ; CHECK: entry.split:
176 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
177 ; Load the shadow of %p and check it
178 ; CHECK: load i64
179 ; CHECK: icmp
180 ; CHECK: br i1
181 ; CHECK: {{^[0-9]+}}:
182182 ; CHECK: [[REG:%[0-9]+]] = bitcast i128* %p to i8*
183183 ; CHECK: @__msan_metadata_ptr_for_store_n(i8* [[REG]], i64 16)
184184 ; CHECK: store i128
185185 ; If the new shadow is non-zero, jump to __msan_chain_origin()
186186 ; CHECK: icmp
187187 ; CHECK: br i1
188 ; CHECK:
188 ; CHECK: {{^[0-9]+}}:
189189 ; CHECK: @__msan_chain_origin
190190 ; Storing origin here:
191191 ; CHECK: store i32
192192 ; CHECK: br label
193 ; CHECK:
193 ; CHECK: {{^[0-9]+}}:
194194 ; CHECK: store i128
195195 ; CHECK: ret void
196196
204204 }
205205
206206 ; CHECK-LABEL: @Load1
207 ; CHECK-LABEL: entry:
208 ; CHECK: @__msan_get_context_state()
209 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
210 ; CHECK-LABEL: entry.split:
211 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
212 ; Load the shadow of %p and check it
213 ; CHECK: load i64
214 ; CHECK: icmp
215 ; CHECK: br i1
216 ; CHECK-LABEL:
207 ; CHECK: entry:
208 ; CHECK: @__msan_get_context_state()
209 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
210 ; CHECK: entry.split:
211 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
212 ; Load the shadow of %p and check it
213 ; CHECK: load i64
214 ; CHECK: icmp
215 ; CHECK: br i1
216 ; CHECK: {{^[0-9]+}}:
217217 ; Load the value from %p. This is done before accessing the shadow
218218 ; to ease atomic handling.
219219 ; CHECK: load i8
230230 }
231231
232232 ; CHECK-LABEL: @Load2
233 ; CHECK-LABEL: entry:
234 ; CHECK: @__msan_get_context_state()
235 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
236 ; CHECK-LABEL: entry.split:
237 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
238 ; Load the shadow of %p and check it
239 ; CHECK: load i64
240 ; CHECK: icmp
241 ; CHECK: br i1
242 ; CHECK-LABEL:
233 ; CHECK: entry:
234 ; CHECK: @__msan_get_context_state()
235 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
236 ; CHECK: entry.split:
237 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
238 ; Load the shadow of %p and check it
239 ; CHECK: load i64
240 ; CHECK: icmp
241 ; CHECK: br i1
242 ; CHECK: {{^[0-9]+}}:
243243 ; Load the value from %p. This is done before accessing the shadow
244244 ; to ease atomic handling.
245245 ; CHECK: load i16
257257 }
258258
259259 ; CHECK-LABEL: @Load4
260 ; CHECK-LABEL: entry:
261 ; CHECK: @__msan_get_context_state()
262 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
263 ; CHECK-LABEL: entry.split:
264 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
265 ; Load the shadow of %p and check it
266 ; CHECK: load i64
267 ; CHECK: icmp
268 ; CHECK: br i1
269 ; CHECK-LABEL:
260 ; CHECK: entry:
261 ; CHECK: @__msan_get_context_state()
262 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
263 ; CHECK: entry.split:
264 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
265 ; Load the shadow of %p and check it
266 ; CHECK: load i64
267 ; CHECK: icmp
268 ; CHECK: br i1
269 ; CHECK: {{^[0-9]+}}:
270270 ; Load the value from %p. This is done before accessing the shadow
271271 ; to ease atomic handling.
272272 ; CHECK: load i32
283283 }
284284
285285 ; CHECK-LABEL: @Load8
286 ; CHECK-LABEL: entry:
287 ; CHECK: @__msan_get_context_state()
288 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
289 ; CHECK-LABEL: entry.split:
290 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
291 ; Load the shadow of %p and check it
292 ; CHECK: load i64
293 ; CHECK: icmp
294 ; CHECK: br i1
295 ; CHECK-LABEL:
286 ; CHECK: entry:
287 ; CHECK: @__msan_get_context_state()
288 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
289 ; CHECK: entry.split:
290 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
291 ; Load the shadow of %p and check it
292 ; CHECK: load i64
293 ; CHECK: icmp
294 ; CHECK: br i1
295 ; CHECK: {{^[0-9]+}}:
296296 ; Load the value from %p. This is done before accessing the shadow
297297 ; to ease atomic handling.
298298 ; CHECK: load i64
309309 }
310310
311311 ; CHECK-LABEL: @Load16
312 ; CHECK-LABEL: entry:
313 ; CHECK: @__msan_get_context_state()
314 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
315 ; CHECK-LABEL: entry.split:
316 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
317 ; Load the shadow of %p and check it
318 ; CHECK: load i64
319 ; CHECK: icmp
320 ; CHECK: br i1
321 ; CHECK-LABEL:
312 ; CHECK: entry:
313 ; CHECK: @__msan_get_context_state()
314 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
315 ; CHECK: entry.split:
316 ; CHECK: ptrtoint {{.*}} [[PARAM_SHADOW]]
317 ; Load the shadow of %p and check it
318 ; CHECK: load i64
319 ; CHECK: icmp
320 ; CHECK: br i1
321 ; CHECK: {{^[0-9]+}}:
322322 ; Load the value from %p. This is done before accessing the shadow
323323 ; to ease atomic handling.
324324 ; CHECK: load i128
358358 ; CHECK: [[VA_ARG_ORIGIN:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 3
359359 ; CHECK: [[VA_ARG_OVERFLOW_SIZE:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 4
360360
361 ; CHECK-LABEL: entry.split:
361 ; CHECK: entry.split:
362362 ; CHECK: [[OSIZE:%[0-9]+]] = load i64, i64* [[VA_ARG_OVERFLOW_SIZE]]
363363 ; Register save area is 48 bytes for non-SSE builds.
364364 ; CHECK: [[SIZE:%[0-9]+]] = add i64 48, [[OSIZE]]
379379
380380 ; CHECK-LABEL: @VarArgCaller
381381
382 ; CHECK-LABEL: entry:
382 ; CHECK: entry:
383383 ; CHECK: @__msan_get_context_state()
384384 ; CHECK: [[PARAM_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 0
385385 ; CHECK: [[VA_ARG_SHADOW:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 2
386386 ; CHECK: [[VA_ARG_OVERFLOW_SIZE:%[a-z0-9_]+]] = getelementptr {{.*}} i32 0, i32 4
387387
388 ; CHECK-LABEL: entry.split:
388 ; CHECK: entry.split:
389389 ; CHECK: [[PARAM_SI:%[_a-z0-9]+]] = ptrtoint {{.*}} [[PARAM_SHADOW]]
390390 ; CHECK: [[ARG1_S:%[_a-z0-9]+]] = inttoptr i64 [[PARAM_SI]] to i64*
391391 ; First argument is initialized
9595 ; CHECK: br i1 [[MSCMP]], label %[[IFTRUE:.*]], label {{.*}}
9696
9797 ; If yes, raise a warning.
98 ; CHECK:
98 ; CHECK: [[IFTRUE]]:
9999 ; CHECK: call void @__msan_warning
100100
7373 ; CHECK: store {{.*}}!dbg ![[DBG:[0-9]+]]
7474 ; CHECK: icmp
7575 ; CHECK: br i1
76 ; CHECK:
76 ; CHECK: {{^[0-9]+}}:
7777
7878 ; Origin tracking level 1: simply store the origin value
7979 ; CHECK-ORIGINS1: store i32 {{.*}}[[ORIGIN]],{{.*}}!dbg !{{.*}}[[DBG]]
8383 ; CHECK-ORIGINS2: store i32 {{.*}}[[ORIGIN2]],{{.*}}!dbg !{{.*}}[[DBG]]
8484
8585 ; CHECK: br label{{.*}}!dbg !{{.*}}[[DBG]]
86 ; CHECK:
86 ; CHECK: {{^[0-9]+}}:
8787 ; CHECK: store{{.*}}!dbg !{{.*}}[[DBG]]
8888 ; CHECK: ret void
2828 ; CHECK: [[lowest:%[^ \t]+]] = load [[intType]], [[intType]]* @__sancov_lowest_stack
2929 ; CHECK: [[cmp:%[^ \t]+]] = icmp ult [[intType]] [[frameInt]], [[lowest]]
3030 ; CHECK: br i1 [[cmp]], label %[[ifLabel:[^ \t]+]], label
31 ; CHECK: [[ifLabel]]:
31 ; CHECK: [[ifLabel]]:
3232 ; CHECK: store [[intType]] [[frameInt]], [[intType]]* @__sancov_lowest_stack
3333 ; CHECK: %call = call i32 @foo()
3434 ; CHECK: ret i32 %call
1515 invoke void @f0()
1616 to label %3 unwind label %1
1717
18 ; 1:
18 1:
1919 %2 = landingpad { i8*, i32 }
2020 catch i8* bitcast (i8** @g to i8*)
2121 catch i8* null
2222 br label %16
2323
24 ; 3:
24 3:
2525 br i1 undef, label %4, label %10
2626
27 ;CHECK:
27 ;CHECK: 4:
2828 ;CHECK-NEXT: %5 = load i32*, i32** undef, align 8
2929 ;CHECK-NEXT: invoke void @f1()
3030
31 ; 4:
31 4:
3232 %5 = load i32*, i32** undef, align 8
3333 invoke void @f1()
3434 to label %6 unwind label %1
3535
36 ;CHECK:
36 ;CHECK: 6:
3737 ;CHECK-NEXT: %7 = load i32*, i32** undef, align 8
3838 ;CHECK-NEXT: %8 = load i32*, i32** undef, align 8
3939
40 ; 6:
40 6:
4141 %7 = load i32*, i32** undef, align 8
4242 %8 = load i32*, i32** undef, align 8
4343 br i1 true, label %9, label %17
4444
45 ; 9:
45 9:
4646 invoke void @f0()
4747 to label %10 unwind label %1
4848
49 ; 10:
49 10:
5050 invoke void @f2()
5151 to label %11 unwind label %1
5252
53 ; 11:
53 11:
5454 %12 = invoke signext i32 undef(i32* null, i32 signext undef, i1 zeroext undef)
5555 to label %13 unwind label %14
5656
57 ; 13:
57 13:
5858 unreachable
5959
60 ; 14:
60 14:
6161 %15 = landingpad { i8*, i32 }
6262 catch i8* bitcast (i8** @g to i8*)
6363 catch i8* null
6464 br label %16
6565
66 ; 16:
66 16:
6767 unreachable
6868
69 ; 17:
69 17:
7070 ret void
7171
7272 ; uselistorder directives
11
22 define i32 @test(i32 %arg) #0 {
33 ; CHECK-LABEL: @test
4 ; CHECK: ;
4 ; CHECK: 2:
55 ; CHECK-NEXT: %res.0 = phi i32 [ 1, %NodeBlock ], [ 2, %1 ]
66 ; CHECK-NEXT: br label %3
7 ; CHECK: ;
7 ; CHECK: 5:
88 ; CHECK-NEXT: %res.3 = phi i32 [ 0, %NewDefault ], [ %res.2, %4 ]
99 ; CHECK-NEXT: %6 = add nsw i32 %res.3, 1
1010 ; CHECK-NEXT: ret i32 %6
1616 i32 4, label %4
1717 ]
1818
19 ;
19 1:
2020 br label %2
2121
22 ;
22 2:
2323 %res.0 = phi i32 [ 1, %0 ], [ 2, %1 ]
2424 br label %3
2525
26 ;
26 3:
2727 %res.1 = phi i32 [ 0, %0 ], [ %res.0, %2 ]
2828 %phitmp = add nsw i32 %res.1, 2
2929 br label %4
3030
31 ;
31 4:
3232 %res.2 = phi i32 [ 1, %0 ], [ %phitmp, %3 ]
3333 br label %5
3434
35 ;
35 5:
3636 %res.3 = phi i32 [ 0, %0 ], [ %res.2, %4 ]
3737 %6 = add nsw i32 %res.3, 1
3838 ret i32 %6