[PATCH] D57129: [SimpleLoopUnswitch] Early check exit for trivial unswitch with MemorySSA.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 25 19:44:32 PST 2019


chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.

LGTM (provided I've not missed anything below w.r.t. atomics).



================
Comment at: lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:852
+      if (auto *Defs = MSSAU->getMemorySSA()->getBlockDefs(CurrentBB))
+        if (!isa<MemoryPhi>(*Defs->begin()) || (++Defs->begin() != Defs->end()))
+          return Changed;
----------------
george.burgess.iv wrote:
> Do atomic ops fall in the same "we care and should exit now" bucket as volatile loads for this?
> 
> MSSA uses MemoryDefs to represent `fence`s and atomic loads with ordering > `unordered`.
I think so yes, and so I think this code is correct?

Such loads "appear" to write to memory and thus I think should bail. At least, this code seems to be remain a good early exit. We still directly test every instruction below.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57129/new/

https://reviews.llvm.org/D57129





More information about the llvm-commits mailing list