[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
This commit is contained in:
Guillaume Chatelet 2019-09-27 08:56:43 +00:00
parent 67cf4fb1cb
commit 7c8bc22ca6
2 changed files with 6 additions and 5 deletions

View File

@ -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 {

View File

@ -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