Skip to content

Commit ab67fe0

Browse files
committed
Set x86_64 JIT stack alignment override to 32
1 parent 51fe0ab commit ab67fe0

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/gallium/auxiliary/gallivm/lp_bld_init.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name,
237237

238238
#if DETECT_ARCH_X86
239239
lp_set_module_stack_alignment_override(gallivm->module, 4);
240+
#elif DETECT_ARCH_X86_64
241+
lp_set_module_stack_alignment_override(gallivm->module, 32);
240242
#endif
241243

242244
gallivm->builder = LLVMCreateBuilderInContext(gallivm->context);

src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,12 @@ llvm::orc::JITTargetMachineBuilder LPJit::create_jtdb() {
399399
* LLVM 3.1+ haven't more "extern unsigned llvm::StackAlignmentOverride" and
400400
* friends for configuring code generation options, like stack alignment.
401401
*/
402-
#if DETECT_ARCH_X86 == 1 && LLVM_VERSION_MAJOR < 13
402+
#if LLVM_VERSION_MAJOR < 13
403+
#if DETECT_ARCH_X86 == 1
403404
options.StackAlignmentOverride = 4;
405+
#elif DETECT_ARCH_X86_64 == 1
406+
options.StackAlignmentOverride = 32;
407+
#endif
404408
#endif
405409

406410
#if DETECT_ARCH_RISCV64 == 1
@@ -563,6 +567,8 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name,
563567
gallivm->context);
564568
#if DETECT_ARCH_X86 == 1
565569
lp_set_module_stack_alignment_override(gallivm->module, 4);
570+
#elif DETECT_ARCH_X86_64 == 1
571+
lp_set_module_stack_alignment_override(gallivm->module, 32);
566572
#endif
567573
gallivm->builder = LLVMCreateBuilderInContext(gallivm->context);
568574
gallivm->_per_module_jd = LPJit::create_jit_dylib(gallivm->module_name);

src/gallium/auxiliary/gallivm/lp_bld_misc.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,12 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
485485
* friends for configuring code generation options, like stack alignment.
486486
*/
487487
TargetOptions options;
488-
#if DETECT_ARCH_X86 && LLVM_VERSION_MAJOR < 13
488+
#if LLVM_VERSION_MAJOR < 13
489+
#if DETECT_ARCH_X86
489490
options.StackAlignmentOverride = 4;
491+
#elif DETECT_ARCH_X86_64
492+
options.StackAlignmentOverride = 32;
493+
#endif
490494
#endif
491495

492496
builder.setEngineKind(EngineKind::JIT)

0 commit comments

Comments
 (0)