[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:
if (a)
return *b += 3;
else
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.
Repository:
rL LLVM
http://reviews.llvm.org/D22143
Files:
lib/Transforms/Utils/SimplifyCFG.cpp
test/CodeGen/ARM/avoid-cpsr-rmw.ll
test/DebugInfo/ARM/single-constant-use-preserves-dbgloc.ll
test/Transforms/SimplifyCFG/AArch64/prefer-fma.ll
test/Transforms/SimplifyCFG/sink-common-code.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22143.63242.patch
Type: text/x-patch
Size: 16862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160708/5dbd6753/attachment.bin>
More information about the llvm-commits
mailing list