[LSR] Canonicalize a formula before insert it into the list
authorAndrew Wei <weiwei64@huawei.com>
Tue, 8 Sep 2020 05:14:53 +0000 (13:14 +0800)
committerAndrew Wei <weiwei64@huawei.com>
Tue, 8 Sep 2020 05:14:53 +0000 (13:14 +0800)
commit78071fb52456f5da9d044588e58a946c0ad96830
treecc9f6896f30140882c7c1fc8d1bc668699067fb8
parente59d9df774ed7d94455b224f0e3f6eaeae707259
[LSR] Canonicalize a formula before insert it into the list

In GenerateConstantOffsetsImpl, we may generate non canonical Formula
if BaseRegs of that Formula is updated and includes a recurrent expr reg
related with current loop while its ScaledReg is not.

Patched by: mdchen
Reviewed By: qcolombet

Differential Revision: https://reviews.llvm.org/D86939
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
llvm/test/Transforms/LoopStrengthReduce/AArch64/pr47329.ll [new file with mode: 0644]