[LoopStrengthReduction] Fix pointer extend asserts
authorBrendon Cahoon <brendon.cahoon@amd.com>
Fri, 30 Jul 2021 16:45:04 +0000 (12:45 -0400)
committerBrendon Cahoon <brendon.cahoon@amd.com>
Fri, 30 Jul 2021 21:24:08 +0000 (17:24 -0400)
commitc4c379d633a136d544436d01c77d75c094d90b12
tree84d9877cd1201fb487cac0f69c8cc97717047ba0
parent8dfd6cae9bd62ae5ef056b994ece2e98f1558830
[LoopStrengthReduction] Fix pointer extend asserts

Additional asserts were added to ScalarEvolution to enforce
pointer/int type rules. An assert is triggered when the LSR pass
attempts to extend a pointer SCEV in GenerateTruncates.

This patch changes GenerateTruncates to exit early if the Formaula
contains a ScaledReg or BaseReg with a pointer type.

Differential Revision: https://reviews.llvm.org/D107185
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
llvm/test/Transforms/LoopStrengthReduce/AMDGPU/lsr-invalid-ptr-extend.ll [new file with mode: 0644]