[PATCH] D67922: [Alignment][NFC] MaybeAlign in GVNExpression
Guillaume Chatelet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 27 01:00:58 PDT 2019
gchatelet updated this revision to Diff 222092.
gchatelet added a comment.
- Address comments
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67922/new/
https://reviews.llvm.org/D67922
Files:
llvm/include/llvm/Transforms/Scalar/GVNExpression.h
llvm/lib/Transforms/Scalar/NewGVN.cpp
Index: llvm/lib/Transforms/Scalar/NewGVN.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -1332,7 +1332,7 @@
E->setOpcode(0);
E->op_push_back(PointerOp);
if (LI)
- E->setAlignment(LI->getAlignment());
+ E->setAlignment(MaybeAlign(LI->getAlignment()));
// TODO: Value number heap versions. We may be able to discover
// things alias analysis can't on it's own (IE that a store and a
Index: llvm/include/llvm/Transforms/Scalar/GVNExpression.h
===================================================================
--- llvm/include/llvm/Transforms/Scalar/GVNExpression.h
+++ llvm/include/llvm/Transforms/Scalar/GVNExpression.h
@@ -323,7 +323,7 @@
class LoadExpression final : public MemoryExpression {
private:
LoadInst *Load;
- unsigned Alignment;
+ MaybeAlign Alignment;
public:
LoadExpression(unsigned NumOperands, LoadInst *L,
@@ -333,7 +333,8 @@
LoadExpression(enum ExpressionType EType, unsigned NumOperands, LoadInst *L,
const MemoryAccess *MemoryLeader)
: MemoryExpression(NumOperands, EType, MemoryLeader), Load(L) {
- Alignment = L ? L->getAlignment() : 0;
+ if (L)
+ Alignment = MaybeAlign(L->getAlignment());
}
LoadExpression() = delete;
@@ -348,8 +349,8 @@
LoadInst *getLoadInst() const { return Load; }
void setLoadInst(LoadInst *L) { Load = L; }
- unsigned getAlignment() const { return Alignment; }
- void setAlignment(unsigned Align) { Alignment = Align; }
+ MaybeAlign getAlignment() const { return Alignment; }
+ void setAlignment(MaybeAlign Align) { Alignment = Align; }
bool equals(const Expression &Other) const override;
bool exactlyEquals(const Expression &Other) const override {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67922.222092.patch
Type: text/x-patch
Size: 1812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190927/b493f12b/attachment.bin>
More information about the llvm-commits
mailing list