[PATCH] D39229: [LoopUnrolling] Do not expand unsafe expressions in loop unrolling

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 04:43:30 PDT 2017


mkazantsev created this revision.

When using SCEVExpander, passes are obliged to make sure that what they request
to expand is safe in terms of expander. We are going to enforce this adding an assert
that it is safe to expand what we request. Currently it causes a failure of one unrolling
test at which we expect unroller to expand division by a value which is potentially zero.

Despite it might be OK to do so because of UB effect of division by zero, we need to
comply with expander's requirements. This patch prohibits expanding unsafe expressions
in loop unrolling. We also make sure that we know that denominator is non-zero, it is
OK to expand such an expression and unroll the loop.


https://reviews.llvm.org/D39229

Files:
  lib/Transforms/Utils/LoopUnrollRuntime.cpp
  test/Transforms/LoopUnroll/high-cost-trip-count-computation.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39229.120040.patch
Type: text/x-patch
Size: 4441 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171024/bd702975/attachment.bin>


More information about the llvm-commits mailing list