Spill slots cannot alias.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84432 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/PseudoSourceValue.cpp b/lib/CodeGen/PseudoSourceValue.cpp
index 289a52b..70e8640 100644
--- a/lib/CodeGen/PseudoSourceValue.cpp
+++ b/lib/CodeGen/PseudoSourceValue.cpp
@@ -63,7 +63,7 @@
virtual bool isConstant(const MachineFrameInfo *MFI) const;
- virtual bool isAliased() const;
+ virtual bool isAliased(const MachineFrameInfo *MFI) const;
virtual void printCustom(raw_ostream &OS) const {
OS << "FixedStack" << FI;
@@ -91,7 +91,7 @@
return false;
}
-bool PseudoSourceValue::isAliased() const {
+bool PseudoSourceValue::isAliased(const MachineFrameInfo *MFI) const {
if (this == getStack() ||
this == getGOT() ||
this == getConstantPool() ||
@@ -105,9 +105,12 @@
return MFI && MFI->isImmutableObjectIndex(FI);
}
-bool FixedStackPseudoSourceValue::isAliased() const{
+bool FixedStackPseudoSourceValue::isAliased(const MachineFrameInfo *MFI) const {
// Negative frame indices are used for special things that don't
// appear in LLVM IR. Non-negative indices may be used for things
// like static allocas.
- return FI >= 0;
+ if (!MFI)
+ return FI >= 0;
+ // Spill slots should not alias others.
+ return !MFI->isFixedObjectIndex(FI) && !MFI->isSpillSlotObjectIndex(FI);
}