diff options
| author | Guillaume Chatelet <gchatelet@google.com> | 2019-10-10 15:38:22 +0000 |
|---|---|---|
| committer | Guillaume Chatelet <gchatelet@google.com> | 2019-10-10 15:38:22 +0000 |
| commit | ff054b9e32307960fbbfde5dbb04a8b79be26fc4 (patch) | |
| tree | d8b2f322d21351785b58709d92e4bdda0410aef9 /llvm/lib/CodeGen | |
| parent | d46a6a9e6865ef71f754d8bcaae5205cf484856d (diff) | |
| download | bcm5719-llvm-ff054b9e32307960fbbfde5dbb04a8b79be26fc4.tar.gz bcm5719-llvm-ff054b9e32307960fbbfde5dbb04a8b79be26fc4.zip | |
[Alignment][NFC] Use llv::Align in GISelKnownBits
Summary:
This is 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/D68786
llvm-svn: 374369
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp index 8f9b7ddeabf..be8efa8795f 100644 --- a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp +++ b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp @@ -33,19 +33,19 @@ GISelKnownBits::GISelKnownBits(MachineFunction &MF) : MF(MF), MRI(MF.getRegInfo()), TL(*MF.getSubtarget().getTargetLowering()), DL(MF.getFunction().getParent()->getDataLayout()) {} -unsigned GISelKnownBits::inferAlignmentForFrameIdx(int FrameIdx, int Offset, - const MachineFunction &MF) { +Align GISelKnownBits::inferAlignmentForFrameIdx(int FrameIdx, int Offset, + const MachineFunction &MF) { const MachineFrameInfo &MFI = MF.getFrameInfo(); - return MinAlign(Offset, MFI.getObjectAlignment(FrameIdx)); + return commonAlignment(Align(MFI.getObjectAlignment(FrameIdx)), Offset); // TODO: How to handle cases with Base + Offset? } -unsigned GISelKnownBits::inferPtrAlignment(const MachineInstr &MI) { +MaybeAlign GISelKnownBits::inferPtrAlignment(const MachineInstr &MI) { if (MI.getOpcode() == TargetOpcode::G_FRAME_INDEX) { int FrameIdx = MI.getOperand(1).getIndex(); return inferAlignmentForFrameIdx(FrameIdx, 0, *MI.getMF()); } - return 0; + return None; } void GISelKnownBits::computeKnownBitsForFrameIndex(Register R, KnownBits &Known, @@ -56,10 +56,10 @@ void GISelKnownBits::computeKnownBitsForFrameIndex(Register R, KnownBits &Known, } void GISelKnownBits::computeKnownBitsForAlignment(KnownBits &Known, - unsigned Align) { - if (Align) + MaybeAlign Alignment) { + if (Alignment) // The low bits are known zero if the pointer is aligned. - Known.Zero.setLowBits(Log2_32(Align)); + Known.Zero.setLowBits(Log2(Alignment)); } KnownBits GISelKnownBits::getKnownBits(MachineInstr &MI) { |

