Reapply "IR: Make getRetAlign check callee function attributes"

Reapply 3d2d208f6a, reverted in
a97e20a3a8
This commit is contained in:
Matt Arsenault 2022-01-14 21:02:15 -05:00
parent 5e5efd8a91
commit 7a5b0a2934

View File

@ -1723,7 +1723,13 @@ public:
}
/// Extract the alignment of the return value.
MaybeAlign getRetAlign() const { return Attrs.getRetAlignment(); }
MaybeAlign getRetAlign() const {
if (auto Align = Attrs.getRetAlignment())
return Align;
if (const Function *F = getCalledFunction())
return F->getAttributes().getRetAlignment();
return None;
}
/// Extract the alignment for a call or parameter (0=unknown).
MaybeAlign getParamAlign(unsigned ArgNo) const {