llvm.org GIT mirror llvm / 13d8288
MemorySSA: Make lifetime starts defs for mustaliased pointers Summary: While we don't want them aliasing with other pointers, there seems to be no point in not having them clobber must-aliased'd pointers. If some day, we split the aliasing and ordering chains, we'd make this not aliasing but an ordering barrier (IE it doesn't affect it's memory, but we can't hoist it above it). Reviewers: hfinkel, george.burgess.iv Subscribers: Prazek, llvm-commits Differential Revision: https://reviews.llvm.org/D31865 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299865 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Berlin 2 years ago
2 changed file(s) with 5 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
213213 AliasAnalysis &AA) {
214214 Instruction *DefInst = MD->getMemoryInst();
215215 assert(DefInst && "Defining instruction not actually an instruction");
216 ImmutableCallSite UseCS(UseInst);
216217
217218 if (const IntrinsicInst *II = dyn_cast(DefInst)) {
218219 // These intrinsics will show up as affecting memory, but they are just
219220 // markers.
220221 switch (II->getIntrinsicID()) {
221222 case Intrinsic::lifetime_start:
223 if (UseCS)
224 return false;
225 return AA.isMustAlias(MemoryLocation(II->getArgOperand(1)), UseLoc);
222226 case Intrinsic::lifetime_end:
223227 case Intrinsic::invariant_start:
224228 case Intrinsic::invariant_end:
229233 }
230234 }
231235
232 ImmutableCallSite UseCS(UseInst);
233236 if (UseCS) {
234237 ModRefInfo I = AA.getModRefInfo(DefInst, UseCS);
235238 return I != MRI_NoModRef;
297300 Instruction *Inst = MD->getMemoryInst();
298301 if (IntrinsicInst *II = dyn_cast(Inst)) {
299302 switch (II->getIntrinsicID()) {
300 case Intrinsic::lifetime_start:
301303 case Intrinsic::lifetime_end:
302304 return AA.isMustAlias(MemoryLocation(II->getArgOperand(1)), Loc);
303305 default:
88 ; CHECK: 1 = MemoryDef(liveOnEntry)
99 ; CHECK-NEXT: call void @llvm.lifetime.start(i64 32, i8* %P)
1010 call void @llvm.lifetime.start(i64 32, i8* %P)
11 ; CHECK: MemoryUse(liveOnEntry)
11 ; CHECK: MemoryUse(1)
1212 ; CHECK-NEXT: %0 = load i8, i8* %P
1313 %0 = load i8, i8* %P
1414 ; CHECK: 2 = MemoryDef(1)