[PATCH] D22143: [SimplifyCFG] Rewrite SinkThenElseCodeToEnd
James Molloy via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 8 09:11:23 PDT 2016
jmolloy created this revision.
jmolloy added reviewers: sanjoy, mcrosier.
jmolloy added a subscriber: llvm-commits.
jmolloy set the repository for this revision to rL LLVM.
The new version has several advantages:
1) (IMNSHO) it's more readable and neater
2) It handles loads and stores properly
3) It can handle any number of incoming blocks rather than just two. I'll be taking advantage of this in a followup patch.
With this change we can now finally sink load-modify-store idioms such as:
return *b += 3;
return *b += 4;
%z = load i32, i32* %y
%.sink = select i1 %a, i32 5, i32 7
%b = add i32 %z, %.sink
store i32 %b, i32* %y
ret i32 %b
When this works for switches it'll be even more powerful.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 16862 bytes
Desc: not available
More information about the llvm-commits