summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/DFAPacketizer.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2017-10-20 22:08:40 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2017-10-20 22:08:40 +0000
commit9d19c8cac9f579011b267c2c8df7b7fcc081e30e (patch)
tree9123d2e34e34974a34209795d036bada6d8860fc /llvm/lib/CodeGen/DFAPacketizer.cpp
parentf1735a58edd9d92b14d9b5d7e3cbab27de5a3019 (diff)
downloadbcm5719-llvm-9d19c8cac9f579011b267c2c8df7b7fcc081e30e.tar.gz
bcm5719-llvm-9d19c8cac9f579011b267c2c8df7b7fcc081e30e.zip
[Packetizer] Add function to check for aliasing between instructions
llvm-svn: 316243
Diffstat (limited to 'llvm/lib/CodeGen/DFAPacketizer.cpp')
-rw-r--r--llvm/lib/CodeGen/DFAPacketizer.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/DFAPacketizer.cpp b/llvm/lib/CodeGen/DFAPacketizer.cpp
index 853b9afa102..cf21316ec22 100644
--- a/llvm/lib/CodeGen/DFAPacketizer.cpp
+++ b/llvm/lib/CodeGen/DFAPacketizer.cpp
@@ -336,6 +336,38 @@ void VLIWPacketizerList::PacketizeMIs(MachineBasicBlock *MBB,
VLIWScheduler->finishBlock();
}
+bool VLIWPacketizerList::alias(const MachineMemOperand &Op1,
+ const MachineMemOperand &Op2,
+ bool UseTBAA) const {
+ if (!Op1.getValue() || !Op2.getValue())
+ return true;
+
+ int64_t MinOffset = std::min(Op1.getOffset(), Op2.getOffset());
+ int64_t Overlapa = Op1.getSize() + Op1.getOffset() - MinOffset;
+ int64_t Overlapb = Op2.getSize() + Op2.getOffset() - MinOffset;
+
+ AliasResult AAResult =
+ AA->alias(MemoryLocation(Op1.getValue(), Overlapa,
+ UseTBAA ? Op1.getAAInfo() : AAMDNodes()),
+ MemoryLocation(Op2.getValue(), Overlapb,
+ UseTBAA ? Op2.getAAInfo() : AAMDNodes()));
+
+ return AAResult != NoAlias;
+}
+
+bool VLIWPacketizerList::alias(const MachineInstr &MI1,
+ const MachineInstr &MI2,
+ bool UseTBAA) const {
+ if (MI1.memoperands_empty() || MI2.memoperands_empty())
+ return true;
+
+ for (const MachineMemOperand *Op1 : MI1.memoperands())
+ for (const MachineMemOperand *Op2 : MI2.memoperands())
+ if (alias(*Op1, *Op2, UseTBAA))
+ return true;
+ return false;
+}
+
// Add a DAG mutation object to the ordered list.
void VLIWPacketizerList::addMutation(
std::unique_ptr<ScheduleDAGMutation> Mutation) {
OpenPOWER on IntegriCloud