[PATCH] D18065: Fix bugs in the MemorySSA walker
George Burgess IV via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 10 14:39:37 PST 2016
george.burgess.iv created this revision.
george.burgess.iv added a reviewer: dberlin.
george.burgess.iv added a subscriber: llvm-commits.
Test case:
```
define void @foo(i1 %b, i8* %ext) {
%a = alloca i8, align 1
%sink = alloca i8, align 1
; 1 = MemoryDef(liveOnEntry) <<<<<<<<
store i8 1, i8* %a, align 1
br i1 %b, label %if.b, label %end
if.b:
; 2 = MemoryDef(1)
store i8 1, i8* %sink
br label %end
end:
; 3 = MemoryPhi({if.b,2},{%0,1})
; MemoryUse(liveOnEntry) <<<<<<<<<<<<<
load i8, i8* %a, align 1
ret void
}
```
...This happens because because of how we recursively walk phis, and how we cache the results afterward. Both of these problems are (hopefully) fixed by this patch.
I plan to move the code around in the loop a bit (because `break;` as the last statement in a `for` is kind of dumb), but I’ve separated that from this patch because the refactor adds a fair amount of noise, and should be NFC.
http://reviews.llvm.org/D18065
Files:
include/llvm/Transforms/Utils/MemorySSA.h
lib/Transforms/Utils/MemorySSA.cpp
test/Transforms/Util/MemorySSA/cyclicphi.ll
test/Transforms/Util/MemorySSA/phi-translation.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18065.50359.patch
Type: text/x-patch
Size: 15329 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160310/8d2ce313/attachment.bin>
More information about the llvm-commits
mailing list