mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[Alignment][NFC] TargetLowering::allowsMisalignedMemoryAccesses
Summary: Note to downstream target maintainers: this might silently change the semantics of your code if you override `TargetLowering::allowsMisalignedMemoryAccesses` without marking it override. This patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Reviewers: courbet Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D81374
This commit is contained in:
parent
574b28f02f
commit
a5cbfdd90d
@ -1578,7 +1578,7 @@ public:
|
|||||||
|
|
||||||
/// LLT handling variant.
|
/// LLT handling variant.
|
||||||
virtual bool allowsMisalignedMemoryAccesses(
|
virtual bool allowsMisalignedMemoryAccesses(
|
||||||
LLT, unsigned AddrSpace = 0, unsigned Align = 1,
|
LLT, unsigned AddrSpace = 0, Align Alignment = Align(1),
|
||||||
MachineMemOperand::Flags Flags = MachineMemOperand::MONone,
|
MachineMemOperand::Flags Flags = MachineMemOperand::MONone,
|
||||||
bool * /*Fast*/ = nullptr) const {
|
bool * /*Fast*/ = nullptr) const {
|
||||||
return false;
|
return false;
|
||||||
|
@ -867,8 +867,7 @@ static bool findGISelOptimalMemOpLowering(std::vector<LLT> &MemOps,
|
|||||||
Ty = LLT::scalar(64);
|
Ty = LLT::scalar(64);
|
||||||
if (Op.isFixedDstAlign())
|
if (Op.isFixedDstAlign())
|
||||||
while (Op.getDstAlign() < Ty.getSizeInBytes() &&
|
while (Op.getDstAlign() < Ty.getSizeInBytes() &&
|
||||||
!TLI.allowsMisalignedMemoryAccesses(Ty, DstAS,
|
!TLI.allowsMisalignedMemoryAccesses(Ty, DstAS, Op.getDstAlign()))
|
||||||
Op.getDstAlign().value()))
|
|
||||||
Ty = LLT::scalar(Ty.getSizeInBytes());
|
Ty = LLT::scalar(Ty.getSizeInBytes());
|
||||||
assert(Ty.getSizeInBits() > 0 && "Could not find valid type");
|
assert(Ty.getSizeInBits() > 0 && "Could not find valid type");
|
||||||
// FIXME: check for the largest legal type we can load/store to.
|
// FIXME: check for the largest legal type we can load/store to.
|
||||||
|
@ -1256,7 +1256,7 @@ bool AArch64TargetLowering::allowsMisalignedMemoryAccesses(
|
|||||||
|
|
||||||
// Same as above but handling LLTs instead.
|
// Same as above but handling LLTs instead.
|
||||||
bool AArch64TargetLowering::allowsMisalignedMemoryAccesses(
|
bool AArch64TargetLowering::allowsMisalignedMemoryAccesses(
|
||||||
LLT Ty, unsigned AddrSpace, unsigned Align, MachineMemOperand::Flags Flags,
|
LLT Ty, unsigned AddrSpace, Align Alignment, MachineMemOperand::Flags Flags,
|
||||||
bool *Fast) const {
|
bool *Fast) const {
|
||||||
if (Subtarget->requiresStrictAlign())
|
if (Subtarget->requiresStrictAlign())
|
||||||
return false;
|
return false;
|
||||||
@ -1271,7 +1271,7 @@ bool AArch64TargetLowering::allowsMisalignedMemoryAccesses(
|
|||||||
// Code that uses clang vector extensions can mark that it
|
// Code that uses clang vector extensions can mark that it
|
||||||
// wants unaligned accesses to be treated as fast by
|
// wants unaligned accesses to be treated as fast by
|
||||||
// underspecifying alignment to be 1 or 2.
|
// underspecifying alignment to be 1 or 2.
|
||||||
Align <= 2 ||
|
Alignment <= 2 ||
|
||||||
|
|
||||||
// Disregard v2i64. Memcpy lowering produces those and splitting
|
// Disregard v2i64. Memcpy lowering produces those and splitting
|
||||||
// them regresses performance on micro-benchmarks and olden/bh.
|
// them regresses performance on micro-benchmarks and olden/bh.
|
||||||
|
@ -413,9 +413,10 @@ public:
|
|||||||
MachineMemOperand::Flags Flags = MachineMemOperand::MONone,
|
MachineMemOperand::Flags Flags = MachineMemOperand::MONone,
|
||||||
bool *Fast = nullptr) const override;
|
bool *Fast = nullptr) const override;
|
||||||
/// LLT variant.
|
/// LLT variant.
|
||||||
bool allowsMisalignedMemoryAccesses(
|
bool allowsMisalignedMemoryAccesses(LLT Ty, unsigned AddrSpace,
|
||||||
LLT Ty, unsigned AddrSpace, unsigned Align, MachineMemOperand::Flags Flags,
|
Align Alignment,
|
||||||
bool *Fast = nullptr) const override;
|
MachineMemOperand::Flags Flags,
|
||||||
|
bool *Fast = nullptr) const override;
|
||||||
|
|
||||||
/// Provide custom lowering hooks for some operations.
|
/// Provide custom lowering hooks for some operations.
|
||||||
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
|
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user