class LoadExpression final : public MemoryExpression {
private:
LoadInst *Load;
- unsigned Alignment;
+ MaybeAlign Alignment;
public:
LoadExpression(unsigned NumOperands, LoadInst *L,
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;
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 {
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