diff options
author | Guillaume Chatelet <gchatelet@google.com> | 2019-09-27 08:56:43 +0000 |
---|---|---|
committer | Guillaume Chatelet <gchatelet@google.com> | 2019-09-27 08:56:43 +0000 |
commit | d886f391af827cd3dc833944a005346b2cf80fae (patch) | |
tree | c7f6b9101b25b699013770d626f5bd8aa20435d5 | |
parent | 2096518d587b9eb35218279e08822ed57f0ab9c7 (diff) | |
download | bcm5719-llvm-d886f391af827cd3dc833944a005346b2cf80fae.tar.gz bcm5719-llvm-d886f391af827cd3dc833944a005346b2cf80fae.zip |
[Alignment][NFC] MaybeAlign in GVNExpression
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/D67922
llvm-svn: 373054
-rw-r--r-- | llvm/include/llvm/Transforms/Scalar/GVNExpression.h | 9 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/NewGVN.cpp | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/llvm/include/llvm/Transforms/Scalar/GVNExpression.h b/llvm/include/llvm/Transforms/Scalar/GVNExpression.h index 3dc4515f85a..1600d1af324 100644 --- a/llvm/include/llvm/Transforms/Scalar/GVNExpression.h +++ b/llvm/include/llvm/Transforms/Scalar/GVNExpression.h @@ -323,7 +323,7 @@ public: class LoadExpression final : public MemoryExpression { private: LoadInst *Load; - unsigned Alignment; + MaybeAlign Alignment; public: LoadExpression(unsigned NumOperands, LoadInst *L, @@ -333,7 +333,8 @@ public: 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 @@ public: 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 { diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp index 902e459b8a9..91c879097af 100644 --- a/llvm/lib/Transforms/Scalar/NewGVN.cpp +++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp @@ -1332,7 +1332,7 @@ LoadExpression *NewGVN::createLoadExpression(Type *LoadType, Value *PointerOp, 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 |