73 lines · plain
1; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s2 3; hfinkel's case4; [entry]5; |6; .....7; (clobbering access - b)8; |9; .... ________________________________10; \ / |11; (x) |12; ...... |13; | |14; | ______________________ |15; \ / | |16; (starting access) | |17; ... | |18; (clobbering access - a) | |19; ... | |20; | | | |21; | |_______________________| |22; | |23; |_________________________________|24;25; More specifically, one access, with multiple clobbering accesses. One of26; which strictly dominates the access, the other of which has a backedge27 28; readnone so we don't have a 1:1 mapping of MemorySSA edges to Instructions.29declare void @doThingWithoutReading() readnone30declare i8 @getValue() readnone31declare i1 @getBool() readnone32 33define hidden void @testcase(ptr %Arg) {34Entry:35 call void @doThingWithoutReading()36 %Val.Entry = call i8 @getValue()37; CHECK: 1 = MemoryDef(liveOnEntry)38; CHECK-NEXT: store i8 %Val.Entry39 store i8 %Val.Entry, ptr %Arg40 call void @doThingWithoutReading()41 br label %OuterLoop42 43OuterLoop:44; CHECK: 5 = MemoryPhi({Entry,1},{InnerLoop.Tail,3})45; CHECK-NEXT: %Val.Outer =46 %Val.Outer = call i8 @getValue()47; CHECK: 2 = MemoryDef(5)48; CHECK-NEXT: store i8 %Val.Outer49 store i8 %Val.Outer, ptr %Arg50 call void @doThingWithoutReading()51 br label %InnerLoop52 53InnerLoop:54; CHECK: 4 = MemoryPhi({OuterLoop,2},{InnerLoop,3})55; CHECK-NEXT: ; MemoryUse(4)56; CHECK-NEXT: %StartingAccess = load57 %StartingAccess = load i8, ptr %Arg, align 458 %Val.Inner = call i8 @getValue()59; CHECK: 3 = MemoryDef(4)60; CHECK-NEXT: store i8 %Val.Inner61 store i8 %Val.Inner, ptr %Arg62 call void @doThingWithoutReading()63 %KeepGoing = call i1 @getBool()64 br i1 %KeepGoing, label %InnerLoop.Tail, label %InnerLoop65 66InnerLoop.Tail:67 %KeepGoing.Tail = call i1 @getBool()68 br i1 %KeepGoing.Tail, label %End, label %OuterLoop69 70End:71 ret void72}73