[AArch64] Fix incorrect `isLegalAddressingMode`
authorMomchil Velikov <momchil.velikov@arm.com>
Thu, 20 Apr 2023 13:51:47 +0000 (14:51 +0100)
committerMomchil Velikov <momchil.velikov@arm.com>
Thu, 20 Apr 2023 14:43:11 +0000 (15:43 +0100)
commit0827e2fa3fd15b49fd2d0fc676753f11abb60cab
tree58174376622268c8ea0e9b9872b078e284bfc329
parente0d884de360b5c3fe79c6a53f8f88b57f0e42275
[AArch64] Fix incorrect `isLegalAddressingMode`

`AArch64TargetLowering::isLegalAddressingMode` has a number of
defects, including accepting an addressing mode which consists of only
an immediate operand, or not checking the offset range for an
addressing mode in the form `1*ScaledReg + Offs`.

This patch fixes the above issues.

Reviewed By: dmgreen

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

Change-Id: I756fa21941844ded44f082ac7eea4391219f9851
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
llvm/test/Transforms/LoopStrengthReduce/AArch64/lsr-pre-inc-offset-check.ll
llvm/unittests/Target/AArch64/AddressingModes.cpp [new file with mode: 0644]
llvm/unittests/Target/AArch64/CMakeLists.txt