[PATCH] D99929: [SCEV] Fix false-positive recognition of simple recurrences. PR49856

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 6 01:06:19 PDT 2021


mkazantsev created this revision.
mkazantsev added reviewers: reames, lebedev.ri, nikic.
Herald added a subscriber: hiraditya.
mkazantsev requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

A value from reachable block may come to a Phi node as its input from
unreachable block. This may confuse matchSimpleRecurrence  which
has no access to DomTree and falsely recognize something as a recurrency
because of this effect, as the attached test shows.

Patch `ae7b1e` deals with half of this problem, but it only accounts from
the case when an unreachable instruction comes to Phi as an input.

This patch provides a generalization by checking that no Phi block's
predecessor is unreachable (no matter what the input is).


https://reviews.llvm.org/D99929

Files:
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/test/Analysis/ScalarEvolution/pr49856.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99929.335424.patch
Type: text/x-patch
Size: 4452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210406/60054b41/attachment.bin>


More information about the llvm-commits mailing list