Use the aligned size for alloca at args when the pass mode is cast.
The `load` and `store` instructions in LLVM access the aligned size.
This commit is contained in:
parent
09e0abb0d1
commit
c453dcd62a
5 changed files with 21 additions and 31 deletions
|
@ -339,7 +339,9 @@ impl CastTarget {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn size<C: HasDataLayout>(&self, _cx: &C) -> Size {
|
||||
/// When you only access the range containing valid data, you can use this unaligned size;
|
||||
/// otherwise, use the safer `size` method.
|
||||
pub fn unaligned_size<C: HasDataLayout>(&self, _cx: &C) -> Size {
|
||||
// Prefix arguments are passed in specific designated registers
|
||||
let prefix_size = self
|
||||
.prefix
|
||||
|
@ -353,6 +355,10 @@ impl CastTarget {
|
|||
prefix_size + rest_size
|
||||
}
|
||||
|
||||
pub fn size<C: HasDataLayout>(&self, cx: &C) -> Size {
|
||||
self.unaligned_size(cx).align_to(self.align(cx))
|
||||
}
|
||||
|
||||
pub fn align<C: HasDataLayout>(&self, cx: &C) -> Align {
|
||||
self.prefix
|
||||
.iter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue