diff options
author | Alina Sbirlea <asbirlea@google.com> | 2019-07-30 20:10:33 +0000 |
---|---|---|
committer | Alina Sbirlea <asbirlea@google.com> | 2019-07-30 20:10:33 +0000 |
commit | 4bc625cae08a82b8a49f2d044c75a4fcf9788cb7 (patch) | |
tree | b1609e2d60b8d787691e93459ad85079534147d3 /llvm/lib/Analysis/MemorySSA.cpp | |
parent | bb669c25ba573b1ae7ac93bd6467dc9854816f5d (diff) | |
download | bcm5719-llvm-4bc625cae08a82b8a49f2d044c75a4fcf9788cb7.tar.gz bcm5719-llvm-4bc625cae08a82b8a49f2d044c75a4fcf9788cb7.zip |
[MemorySSA] Extend allowed behavior for simplified instructions.
Summary:
LoopRotate may simplify instructions, leading to the new instructions not having memory accesses created for them.
Allow this behavior, by allowing the new access to be null when the template is null, and looking upwards for the proper defined access when dealing with simplified instructions.
Reviewers: george.burgess.iv
Subscribers: jlebar, Prazek, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65338
llvm-svn: 367352
Diffstat (limited to 'llvm/lib/Analysis/MemorySSA.cpp')
-rw-r--r-- | llvm/lib/Analysis/MemorySSA.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp index 17f5d9b9f0a..5df56ddd8e3 100644 --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -1687,13 +1687,15 @@ MemoryPhi *MemorySSA::createMemoryPhi(BasicBlock *BB) { MemoryUseOrDef *MemorySSA::createDefinedAccess(Instruction *I, MemoryAccess *Definition, - const MemoryUseOrDef *Template) { + const MemoryUseOrDef *Template, + bool CreationMustSucceed) { assert(!isa<PHINode>(I) && "Cannot create a defined access for a PHI"); MemoryUseOrDef *NewAccess = createNewAccess(I, AA, Template); - assert( - NewAccess != nullptr && - "Tried to create a memory access for a non-memory touching instruction"); - NewAccess->setDefiningAccess(Definition); + if (CreationMustSucceed) + assert(NewAccess != nullptr && "Tried to create a memory access for a " + "non-memory touching instruction"); + if (NewAccess) + NewAccess->setDefiningAccess(Definition); return NewAccess; } |