llvm2alive: add alignment to global const stores
this helps the static analysis determine max alignment in mem operations
MODIFY
ir/value.h
ir/value.h
@@ -89,6 +89,7 @@ public:
Value(type, std::move(name)), allocsize(allocsize), align(align),
isconst(isconst) {}
uint64_t size() const { return allocsize; }
+ unsigned getAlignment() const { return align; }
bool isConst() const { return isconst; }
void print(std::ostream &os) const override;
StateValue toSMT(State &s) const override;

MODIFY
llvm_util/llvm2alive.cpp
llvm_util/llvm2alive.cpp
@@ -722,13 +722,11 @@ public:
continue;
auto storedval = get_operand(gv->getInitializer());
- auto globalvar = get_operand(gv);
- if (!storedval || !globalvar)
+ if (!storedval)
return {};
- // Alignment is already enforced by Memory::alloc.
stores.emplace(gv->getName(),
- make_unique<Store>(*globalvar, *storedval, 1));
+ make_unique<Store>(*GV, *storedval, GV->getAlignment()));
}
for (auto &itm : stores)

llvm2alive: add alignment to global const stores
this helps the static analysis determine max alignment in mem operations