[ARM][TTI] Prevents constants in a min(max) or max(min) pattern from being hoisted...
authorMeera Nakrani <meera.nakrani@arm.com>
Tue, 22 Sep 2020 11:54:10 +0000 (11:54 +0000)
committerMeera Nakrani <meera.nakrani@arm.com>
Tue, 22 Sep 2020 11:54:10 +0000 (11:54 +0000)
commita3d0dce2608bb399f2bf0122d8c6a4c7b4d6c1fa
tree9e64138139f547e7eb585404a2e94d5b03104233
parentb5e49e91cb90eda1f926139c8567e27f1b664cc1
[ARM][TTI] Prevents constants in a min(max) or max(min) pattern from being hoisted when in a loop

Changes TTI function getIntImmCostInst to take an additional Instruction parameter,
which enables us to be able to check it is part of a min(max())/max(min()) pattern that will match SSAT.
We can then mark the constant used as free to prevent it being hoisted so SSAT can still be generated.
Required minor changes in some non-ARM backends to allow for the optional parameter to be included.

Differential Revision: https://reviews.llvm.org/D87457
18 files changed:
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
llvm/lib/Target/ARM/ARMTargetTransformInfo.h
llvm/lib/Target/Lanai/LanaiTargetTransformInfo.h
llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.h
llvm/lib/Target/X86/X86TargetTransformInfo.cpp
llvm/lib/Target/X86/X86TargetTransformInfo.h
llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
llvm/test/CodeGen/Thumb2/mve-satmul-loops.ll