[PATCH] D57129: [SimpleLoopUnswitch] Early check exit for trivial unswitch with MemorySSA.
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 23 17:16:53 PST 2019
asbirlea created this revision.
asbirlea added a reviewer: chandlerc.
Herald added subscribers: george.burgess.iv, Prazek, jlebar, sanjoy.
If MemorySSA is avaiable, we can skip checking all instructions if block has any Defs.
(volatile loads are also Defs).
We still need to check all instructions for "canThrow", even if no Defs are found.
Repository:
rL LLVM
https://reviews.llvm.org/D57129
Files:
lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
Index: lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
===================================================================
--- lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
+++ lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
@@ -847,6 +847,10 @@
// Check if there are any side-effecting instructions (e.g. stores, calls,
// volatile loads) in the part of the loop that the code *would* execute
// without unswitching.
+ if (MSSAU) // Possible early exit with MSSA
+ if (auto *Defs = MSSAU->getMemorySSA()->getBlockDefs(CurrentBB))
+ if (!isa<MemoryPhi>(*Defs->begin()) || (++Defs->begin() != Defs->end()))
+ return Changed;
if (llvm::any_of(*CurrentBB,
[](Instruction &I) { return I.mayHaveSideEffects(); }))
return Changed;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57129.183217.patch
Type: text/x-patch
Size: 791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190124/0c202179/attachment.bin>
More information about the llvm-commits
mailing list