Skip to content

Commit 3578509

Browse files
allightcopybara-github
authored andcommitted
Use preferred alignment instead of stack.
We were using the stack alignment as a minimum alignment for types which is not really needed. Just use the LLVM preferred alignment instead. Overall JIT performance is basically unaffected. PiperOrigin-RevId: 595193896
1 parent 64c7e98 commit 3578509

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

xls/jit/llvm_type_converter.cc

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,22 +173,12 @@ int64_t LlvmTypeConverter::GetTypeAbiAlignment(const Type* type) const {
173173
return data_layout_.getABITypeAlign(ConvertToLlvmType(type)).value();
174174
}
175175
int64_t LlvmTypeConverter::GetTypePreferredAlignment(const Type* type) const {
176-
// NB We ask for stack alignment since we often memcpy things around which is
177-
// slightly faster at higher alignments.
178-
llvm::Align alignment =
179-
data_layout_.getPrefTypeAlign(ConvertToLlvmType(type));
180-
if (data_layout_.exceedsNaturalStackAlignment(alignment)) {
181-
return alignment.value();
182-
}
183-
return data_layout_.getStackAlignment().value();
176+
return data_layout_.getPrefTypeAlign(ConvertToLlvmType(type)).value();
184177
}
185178
int64_t LlvmTypeConverter::AlignFor(const Type* type, int64_t offset) const {
186179
llvm::Align alignment =
187180
data_layout_.getPrefTypeAlign(ConvertToLlvmType(type));
188-
if (data_layout_.exceedsNaturalStackAlignment(alignment)) {
189-
return llvm::alignTo(offset, alignment);
190-
}
191-
return llvm::alignTo(offset, data_layout_.getStackAlignment());
181+
return llvm::alignTo(offset, alignment);
192182
}
193183

194184
llvm::Type* LlvmTypeConverter::GetTokenType() const {

0 commit comments

Comments
 (0)