[PATCH] D77079: [Alignment][NFC] GlobalIsel Utils inferAlignFromPtrInfo
Guillaume Chatelet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 30 11:57:12 PDT 2020
gchatelet created this revision.
gchatelet added a reviewer: courbet.
Herald added subscribers: llvm-commits, volkan, hiraditya, rovka.
Herald added a project: LLVM.
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
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77079
Files:
llvm/include/llvm/CodeGen/GlobalISel/Utils.h
llvm/lib/CodeGen/GlobalISel/Utils.cpp
Index: llvm/lib/CodeGen/GlobalISel/Utils.cpp
===================================================================
--- llvm/lib/CodeGen/GlobalISel/Utils.cpp
+++ llvm/lib/CodeGen/GlobalISel/Utils.cpp
@@ -457,15 +457,16 @@
return false;
}
-unsigned llvm::inferAlignmentFromPtrInfo(MachineFunction &MF,
- const MachinePointerInfo &MPO) {
+Align llvm::inferAlignFromPtrInfo(MachineFunction &MF,
+ const MachinePointerInfo &MPO) {
auto PSV = MPO.V.dyn_cast<const PseudoSourceValue *>();
if (auto FSPV = dyn_cast_or_null<FixedStackPseudoSourceValue>(PSV)) {
MachineFrameInfo &MFI = MF.getFrameInfo();
- return MinAlign(MFI.getObjectAlignment(FSPV->getFrameIndex()), MPO.Offset);
+ return commonAlignment(MFI.getObjectAlign(FSPV->getFrameIndex()),
+ MPO.Offset);
}
- return 1;
+ return Align(1);
}
Optional<APInt> llvm::ConstantFoldExtOp(unsigned Opcode, const unsigned Op1,
Index: llvm/include/llvm/CodeGen/GlobalISel/Utils.h
===================================================================
--- llvm/include/llvm/CodeGen/GlobalISel/Utils.h
+++ llvm/include/llvm/CodeGen/GlobalISel/Utils.h
@@ -16,6 +16,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/Register.h"
+#include "llvm/Support/Alignment.h"
#include "llvm/Support/LowLevelTypeImpl.h"
#include "llvm/Support/MachineValueType.h"
@@ -181,8 +182,13 @@
return isKnownNeverNaN(Val, MRI, true);
}
-unsigned inferAlignmentFromPtrInfo(MachineFunction &MF,
- const MachinePointerInfo &MPO);
+Align inferAlignFromPtrInfo(MachineFunction &MF, const MachinePointerInfo &MPO);
+
+/// FIXME: Remove once the transition to Align is over.
+inline unsigned inferAlignmentFromPtrInfo(MachineFunction &MF,
+ const MachinePointerInfo &MPO) {
+ return inferAlignFromPtrInfo(MF, MPO).value();
+}
/// Return the least common multiple type of \p Ty0 and \p Ty1, by changing
/// the number of vector elements or scalar bitwidth. The intent is a
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77079.253654.patch
Type: text/x-patch
Size: 2111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200330/cd15f91f/attachment-0001.bin>
More information about the llvm-commits
mailing list