[PATCH] D70593: [LCSSA] Don't use VH callbacks to invalidate SCEV when creating LCSSA phis

Daniil Suchkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 22 03:57:37 PST 2019


DaniilSuchkov created this revision.
DaniilSuchkov added reviewers: fhahn, efriedma, reames, sanjoy.google.
Herald added subscribers: llvm-commits, javed.absar, hiraditya.
Herald added a project: LLVM.
DaniilSuchkov retitled this revision from "[LCSSA] Don't use VH callbacks to invalidate SCEV" to "[LCSSA] Don't use VH callbacks to invalidate SCEV when creating LCSSA phis".
DaniilSuchkov added a parent revision: D70423: [SCEV] Introduce ScalarEvolutionVerifierPass.

In general ValueHandleBase::ValueIsRAUWd shouldn't be called when not all uses of the value were actually replaced, though, currently formLCSSAForInstructions calls it when it inserts LCSSA-phis.

Calls of ValueHandleBase::ValueIsRAUWd were added to LCSSA specifically to update/invalidate SCEV. In the best case these calls duplicate some of the work already done by SE->forgetValue, though in case when SCEV of the value is SCEVUnknown, SCEV replaces the underlying value of SCEVUnknown with the new value (i.e. acts like LCSSA-phi actually fully replaces the value it is created for), which leads to SCEV being corrupted because LCSSA-phi rarely dominates all uses of its inputs.

This fixes bug https://bugs.llvm.org/show_bug.cgi?id=44058.


https://reviews.llvm.org/D70593

Files:
  llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
  llvm/lib/Transforms/Utils/LCSSA.cpp
  llvm/test/Transforms/LCSSA/pr44058.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70593.230615.patch
Type: text/x-patch
Size: 4996 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191122/a1daeaa8/attachment-0001.bin>


More information about the llvm-commits mailing list