[PATCH] D38566: [SimplifyCFG] don't sink common insts too soon (PR34603)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 15:41:19 PDT 2017


spatel created this revision.
Herald added a subscriber: mcrosier.

This is a minimal patch to solve PR34603:
https://bugs.llvm.org/show_bug.cgi?id=34603

As discussed there, we need to prevent SimplifyCFG from performing aggressive flattening before early-cse, GVN, and potentially other passes have had a chance to run because we may not be able to see through those transformations. In the example from the original bug report (PR28343), this prevents a whole series of optimizations: recognizing a 'max', vectorizing that max, unrolling a loop, etc.

I've opted to just keep going with the current -simplifycfg / -latesimplifycfg separation, but we could lift the individual options to the pass manager layer if that seems better.


https://reviews.llvm.org/D38566

Files:
  include/llvm/Transforms/Utils/Local.h
  lib/Transforms/Scalar/SimplifyCFGPass.cpp
  lib/Transforms/Utils/SimplifyCFG.cpp
  test/Transforms/PhaseOrdering/earlycse-before-latesimplifycfg.ll
  test/Transforms/SimplifyCFG/no-md-sink.ll
  test/Transforms/SimplifyCFG/sink-common-code.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38566.117750.patch
Type: text/x-patch
Size: 9018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171004/fcbdf8b6/attachment.bin>


More information about the llvm-commits mailing list