[PATCH] D27216: [SCEVExpand] do not hoist divisions by zero (PR30935)

Sebastian Pop via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 09:44:28 PST 2016


sebpop created this revision.
sebpop added reviewers: sanjoy, spatel, atrick.
sebpop added subscribers: llvm-commits, hiraditya.
Herald added a subscriber: mzolotukhin.

SCEVExpand computes the insertion point for the components of a SCEV to be code generated.
When it comes to generating code for a division SCEVexpand would not be able to check (at compilation time) all the conditions necessary to avoid a division by zero.
The patch disables hoisting of expressions containing divisions by anything other than constants in order to avoid hoisting these expressions past conditions that should hold before doing the division.

The patch passes check-all on x86_64-linux.


https://reviews.llvm.org/D27216

Files:
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/Analysis/ScalarEvolutionExpander.cpp
  llvm/test/Transforms/LoopIdiom/pr30935.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27216.79593.patch
Type: text/x-patch
Size: 8323 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161129/49c6f825/attachment.bin>


More information about the llvm-commits mailing list