OSDN Git Service

[SCEV] Make getPostIncExpr guaranteed to return AddRec
authorMax Kazantsev <max.kazantsev@azul.com>
Mon, 12 Feb 2018 05:09:38 +0000 (05:09 +0000)
committerMax Kazantsev <max.kazantsev@azul.com>
Mon, 12 Feb 2018 05:09:38 +0000 (05:09 +0000)
commite4f9fdee4b7b69684d2963f2ba48f6e5d9f284b5
tree3ba3e983d3fa7f069909d0ec1f64a57021620a63
parent00884fea345f47ab05174a8f314ecd60d1676d02
[SCEV] Make getPostIncExpr guaranteed to return AddRec

The current implementation of `getPostIncExpr` invokes `getAddExpr` for two recurrencies
and expects that it always returns it a recurrency. But this is not guaranteed to happen if we
have reached max recursion depth or refused to make SCEV simplification for other reasons.

This patch changes its implementation so that now it always returns SCEVAddRec without
relying on `getAddExpr`.

Differential Revision: https://reviews.llvm.org/D42953

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324866 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/ScalarEvolutionExpressions.h
lib/Analysis/ScalarEvolution.cpp
test/Analysis/ScalarEvolution/pr35890.ll [new file with mode: 0644]