[PATCH] D50377: [MustExecute] Rework LoopSafetyInfo to make it more optimistic about throws

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 7 02:46:45 PDT 2018


mkazantsev created this revision.
mkazantsev added reviewers: dstenb, skatkov, reames.
Herald added a subscriber: zzheng.

Currently `isGuaranteedToExecute` is too pessimistic about blocks in loops that contain
throwing instructions. It may return `false` for any instruction in non-header block if the
loop contains throwers, even if this instruction is executed before any potential thrower.

This patch reworks `LoopSafetyInfo` to use implicit control flow logic for checks. As result,
it may now answer queries "is it possible to throw before we executed given bb/instruction?"
This gives more accurate analysis results for LICM and other transforms. In particular, it allows
hoisting of non-speculable loads from non-header mustexecute blocks.


https://reviews.llvm.org/D50377

Files:
  include/llvm/Analysis/MustExecute.h
  lib/Analysis/MustExecute.cpp
  lib/Transforms/Scalar/LICM.cpp
  lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  lib/Transforms/Scalar/LoopUnswitch.cpp
  lib/Transforms/Utils/LoopUnrollAndJam.cpp
  test/Analysis/MustExecute/loop-header.ll
  test/Transforms/LICM/funclet.ll
  test/Transforms/LICM/hoist-mustexec.ll
  test/Transforms/LICM/hoist-nounwind.ll
  test/Transforms/LICM/sinking.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50377.159470.patch
Type: text/x-patch
Size: 27138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180807/f0331761/attachment.bin>


More information about the llvm-commits mailing list