diff options
author | Max Kazantsev <max.kazantsev@azul.com> | 2018-09-04 05:01:35 +0000 |
---|---|---|
committer | Max Kazantsev <max.kazantsev@azul.com> | 2018-09-04 05:01:35 +0000 |
commit | 2cbba5633753552a984572c8b9a5997e5c96496d (patch) | |
tree | a900bb79706f535da925a223e42953de9104d578 /clang/unittests/Basic/VirtualFileSystemTest.cpp | |
parent | bd203e03f89a0664c22c7b9ca74fd1b2fdf6f0c0 (diff) | |
download | llvm-2cbba5633753552a984572c8b9a5997e5c96496d.zip llvm-2cbba5633753552a984572c8b9a5997e5c96496d.tar.gz llvm-2cbba5633753552a984572c8b9a5997e5c96496d.tar.bz2 |
[IndVars] Fix usage of SCEVExpander to not mess with SCEVConstant. PR38674
This patch removes the function `expandSCEVIfNeeded` which behaves not as
it was intended. This function tries to make a lookup for exact existing expansion
and only goes to normal expansion via `expandCodeFor` if this lookup hasn't found
anything. As a result of this, if some instruction above the loop has a `SCEVConstant`
SCEV, this logic will return this instruction when asked for this `SCEVConstant` rather
than return a constant value. This is both non-profitable and in some cases leads to
breach of LCSSA form (as in PR38674).
Whether or not it is possible to break LCSSA with this algorithm and with some
non-constant SCEVs is still in question, this is still being investigated. I wasn't
able to construct such a test so far, so maybe this situation is impossible. If it is,
it will go as a separate fix.
Rather than do it, it is always correct to just invoke `expandCodeFor` unconditionally:
it behaves smarter about insertion points, and as side effect of this it will choose a
constant value for SCEVConstants. For other SCEVs it may end up finding a better insertion
point. So it should not be worse in any case.
NOTE: So far the only known case for which this transform may break LCSSA is mapping
of SCEVConstant to an instruction. However there is a suspicion that the entire algorithm
can compromise LCSSA form for other cases as well (yet not proved).
Differential Revision: https://reviews.llvm.org/D51286
Reviewed By: etherzhhb
llvm-svn: 341345
Diffstat (limited to 'clang/unittests/Basic/VirtualFileSystemTest.cpp')
0 files changed, 0 insertions, 0 deletions