[llvm] r308502 - [Hexagon] Handle subregisters in areMemAccessesTriviallyDisjoint
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 19 11:03:47 PDT 2017
Author: kparzysz
Date: Wed Jul 19 11:03:46 2017
New Revision: 308502
URL: http://llvm.org/viewvc/llvm-project?rev=308502&view=rev
Log:
[Hexagon] Handle subregisters in areMemAccessesTriviallyDisjoint
Modified:
llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp
Modified: llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp?rev=308502&r1=308501&r2=308502&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp Wed Jul 19 11:03:46 2017
@@ -1677,9 +1677,6 @@ DFAPacketizer *HexagonInstrInfo::CreateT
// Currently AA considers the addresses in these instructions to be aliasing.
bool HexagonInstrInfo::areMemAccessesTriviallyDisjoint(
MachineInstr &MIa, MachineInstr &MIb, AliasAnalysis *AA) const {
- int OffsetA = 0, OffsetB = 0;
- unsigned SizeA = 0, SizeB = 0;
-
if (MIa.hasUnmodeledSideEffects() || MIb.hasUnmodeledSideEffects() ||
MIa.hasOrderedMemoryRef() || MIb.hasOrderedMemoryRef())
return false;
@@ -1689,27 +1686,47 @@ bool HexagonInstrInfo::areMemAccessesTri
if (MIa.mayLoad() && !isMemOp(MIa) && MIb.mayLoad() && !isMemOp(MIb))
return true;
- // Get base, offset, and access size in MIa.
- unsigned BaseRegA = getBaseAndOffset(MIa, OffsetA, SizeA);
- if (!BaseRegA || !SizeA)
+ // Get the base register in MIa.
+ unsigned BasePosA, OffsetPosA;
+ if (!getBaseAndOffsetPosition(MIa, BasePosA, OffsetPosA))
+ return false;
+ const MachineOperand &BaseA = MIa.getOperand(BasePosA);
+ unsigned BaseRegA = BaseA.getReg();
+ unsigned BaseSubA = BaseA.getSubReg();
+
+ // Get the base register in MIb.
+ unsigned BasePosB, OffsetPosB;
+ if (!getBaseAndOffsetPosition(MIb, BasePosB, OffsetPosB))
return false;
+ const MachineOperand &BaseB = MIb.getOperand(BasePosB);
+ unsigned BaseRegB = BaseB.getReg();
+ unsigned BaseSubB = BaseB.getSubReg();
- // Get base, offset, and access size in MIb.
- unsigned BaseRegB = getBaseAndOffset(MIb, OffsetB, SizeB);
- if (!BaseRegB || !SizeB)
+ if (BaseRegA != BaseRegB || BaseSubA != BaseSubB)
return false;
- if (BaseRegA != BaseRegB)
+ // Get the access sizes.
+ unsigned SizeA = (1u << (getMemAccessSize(MIa) - 1));
+ unsigned SizeB = (1u << (getMemAccessSize(MIb) - 1));
+
+ // Get the offsets. Handle immediates only for now.
+ const MachineOperand &OffA = MIa.getOperand(OffsetPosA);
+ const MachineOperand &OffB = MIb.getOperand(OffsetPosB);
+ if (!MIa.getOperand(OffsetPosA).isImm() ||
+ !MIb.getOperand(OffsetPosB).isImm())
return false;
+ int OffsetA = OffA.getImm();
+ int OffsetB = OffB.getImm();
// This is a mem access with the same base register and known offsets from it.
// Reason about it.
if (OffsetA > OffsetB) {
- uint64_t offDiff = (uint64_t)((int64_t)OffsetA - (int64_t)OffsetB);
- return (SizeB <= offDiff);
- } else if (OffsetA < OffsetB) {
- uint64_t offDiff = (uint64_t)((int64_t)OffsetB - (int64_t)OffsetA);
- return (SizeA <= offDiff);
+ uint64_t OffDiff = (uint64_t)((int64_t)OffsetA - (int64_t)OffsetB);
+ return SizeB <= OffDiff;
+ }
+ if (OffsetA < OffsetB) {
+ uint64_t OffDiff = (uint64_t)((int64_t)OffsetB - (int64_t)OffsetA);
+ return SizeA <= OffDiff;
}
return false;
More information about the llvm-commits
mailing list