summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/MemorySSA.cpp
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2016-03-21 21:25:39 +0000
committerGeorge Burgess IV <george.burgess.iv@gmail.com>2016-03-21 21:25:39 +0000
commit3887a4172528d14b88b5d254866c4466fbddcfc9 (patch)
tree85a3e730da692c202635ea1c1add7e3c83c4f489 /llvm/lib/Transforms/Utils/MemorySSA.cpp
parent67e6ae5e2a44388bf46f5f1281085ff8b6d5f5d2 (diff)
downloadbcm5719-llvm-3887a4172528d14b88b5d254866c4466fbddcfc9.tar.gz
bcm5719-llvm-3887a4172528d14b88b5d254866c4466fbddcfc9.zip
[MemorySSA] Consider def-only BBs for live-in calculations.
If we have a BB with only MemoryDefs, live-in calculations will ignore it. This means we get results like this: define void @foo(i8* %p) { ; 1 = MemoryDef(liveOnEntry) store i8 0, i8* %p br i1 undef, label %if.then, label %if.end if.then: ; 2 = MemoryDef(1) store i8 1, i8* %p br label %if.end if.end: ; 3 = MemoryDef(1) store i8 2, i8* %p ret void } ...When there should be a MemoryPhi in the `if.end` BB. This patch fixes that behavior. llvm-svn: 263991
Diffstat (limited to 'llvm/lib/Transforms/Utils/MemorySSA.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/MemorySSA.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/MemorySSA.cpp b/llvm/lib/Transforms/Utils/MemorySSA.cpp
index f49d666d1a0..a794406da15 100644
--- a/llvm/lib/Transforms/Utils/MemorySSA.cpp
+++ b/llvm/lib/Transforms/Utils/MemorySSA.cpp
@@ -253,17 +253,13 @@ MemorySSAWalker *MemorySSA::buildMemorySSA(AliasAnalysis *AA,
// Go through each block, figure out where defs occur, and chain together all
// the accesses.
for (BasicBlock &B : F) {
- bool InsertIntoDefUse = false;
bool InsertIntoDef = false;
AccessListType *Accesses = nullptr;
for (Instruction &I : B) {
MemoryUseOrDef *MUD = createNewAccess(&I, true);
if (!MUD)
continue;
- if (isa<MemoryDef>(MUD))
- InsertIntoDef = true;
- else
- InsertIntoDefUse = true;
+ InsertIntoDef |= isa<MemoryDef>(MUD);
if (!Accesses)
Accesses = getOrCreateAccessList(&B);
@@ -271,7 +267,7 @@ MemorySSAWalker *MemorySSA::buildMemorySSA(AliasAnalysis *AA,
}
if (InsertIntoDef)
DefiningBlocks.insert(&B);
- if (InsertIntoDefUse)
+ if (Accesses)
DefUseBlocks.insert(&B);
}
OpenPOWER on IntegriCloud