aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2022-06-24 12:09:34 -0400
committerMatt Arsenault <Matthew.Arsenault@amd.com>2022-07-18 17:23:41 -0400
commit8d0383eb694e13a999c9c95adc4b56771429e551 (patch)
treed8a1bf195a3deb4dcc79f5f5036fbaf6f41c50c7 /llvm/lib/CodeGen/MachineInstr.cpp
parentbf7f01d857eda2ea0753e92149c2941c7ad84bbc (diff)
downloadllvm-8d0383eb694e13a999c9c95adc4b56771429e551.zip
llvm-8d0383eb694e13a999c9c95adc4b56771429e551.tar.gz
llvm-8d0383eb694e13a999c9c95adc4b56771429e551.tar.bz2
CodeGen: Remove AliasAnalysis from regalloc
This was stored in LiveIntervals, but not actually used for anything related to LiveIntervals. It was only used in one check for if a load instruction is rematerializable. I also don't think this was entirely correct, since it was implicitly assuming constant loads are also dereferenceable. Remove this and rely only on the invariant+dereferenceable flags in the memory operand. Set the flag based on the AA query upfront. This should have the same net benefit, but has the possible disadvantage of making this AA query nonlazy. Preserve the behavior of assuming pointsToConstantMemory implying dereferenceable for now, but maybe this should be changed.
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index ebec55b..e92dec5 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -1203,7 +1203,7 @@ bool MachineInstr::isSafeToMove(AAResults *AA, bool &SawStore) const {
// destination. The check for isInvariantLoad gives the target the chance to
// classify the load as always returning a constant, e.g. a constant pool
// load.
- if (mayLoad() && !isDereferenceableInvariantLoad(AA))
+ if (mayLoad() && !isDereferenceableInvariantLoad())
// Otherwise, this is a real load. If there is a store between the load and
// end of block, we can't move it.
return !SawStore;
@@ -1348,7 +1348,7 @@ bool MachineInstr::hasOrderedMemoryRef() const {
/// isDereferenceableInvariantLoad - Return true if this instruction will never
/// trap and is loading from a location whose value is invariant across a run of
/// this function.
-bool MachineInstr::isDereferenceableInvariantLoad(AAResults *AA) const {
+bool MachineInstr::isDereferenceableInvariantLoad() const {
// If the instruction doesn't load at all, it isn't an invariant load.
if (!mayLoad())
return false;
@@ -1374,12 +1374,6 @@ bool MachineInstr::isDereferenceableInvariantLoad(AAResults *AA) const {
if (const PseudoSourceValue *PSV = MMO->getPseudoValue()) {
if (PSV->isConstant(&MFI))
continue;
- } else if (const Value *V = MMO->getValue()) {
- // If we have an AliasAnalysis, ask it whether the memory is constant.
- if (AA &&
- AA->pointsToConstantMemory(
- MemoryLocation(V, MMO->getSize(), MMO->getAAInfo())))
- continue;
}
// Otherwise assume conservatively.