@rnk pointed out in [1] that x86's canRealignStack logic should match that in CantUseSP from hasBasePointer.
[1]: http://reviews.llvm.org/D11160?id=29713#inline-89350
Differential D11377
x86: check hasOpaqueSPAdjustment in canRealignStack jfb on Jul 20 2015, 5:10 PM. Authored by
Details @rnk pointed out in [1] that x86's canRealignStack logic should match that in CantUseSP from hasBasePointer. [1]: http://reviews.llvm.org/D11160?id=29713#inline-89350
Diff Detail Event TimelineComment Actions I'm not sure how to test this. I tried something similar to test/CodeGen/X86/inline-asm-stack-realign3.ll but without success: ; RUN: llc -march=x86 -no-integrated-as < %s | FileCheck %s declare void @bar(i32* %junk) define i32 @foo(i1 %cond) { entry: %r = alloca i32, align 128 store i32 -1, i32* %r, align 128 br i1 %cond, label %doit, label %skip doit: call void asm sideeffect "xor %esi, %esi\0A\09mov %esi, $0", "=*m,~{esi},~{flags}"(i32* %r) %junk = alloca i32 call void @bar(i32* %junk) br label %skip skip: %0 = load i32, i32* %r, align 128 ret i32 %0 } This generates the following code: _foo: # @foo # BB#0: # %entry pushl %ebp movl %esp, %ebp pushl %esi andl $-128, %esp subl $128, %esp movl %esp, %esi movl $-1, (%esi) testb $1, 8(%ebp) je LBB0_2 # BB#1: # %doit #APP xorl %esi, %esi movl %esi, (%esi) #NO_APP movl $4, %eax calll __chkstk movl %esp, %eax pushl %eax calll _bar addl $4, %esp LBB0_2: # %skip movl (%esi), %eax leal -4(%ebp), %esp popl %esi popl %ebp retl Which seems wrong, but is the same as before this patch, so I'm assuming it doesn't trigger my change. Any ideas on how to trigger the change? Comment Actions Right, your test case is essentially To get into a case where canRealignStack matters, I think you need:
hasVarSizedObjects())
register allocation (is live across a call) If that doesn't do it, then I think this code is dynamically dead, at least My understanding is that the original purpose of canRealignStack was to Then, at some point, someone decided that realigning the stack was too So, it sounds like this change is untestable, but I feel like we should Comment Actions Ah that makes sense. I'm OK with no test if you are, considering I couldn't generate one! Comment Actions @jfb - no worries; I added Jim and Jakob because I knew they were somewhat familiar with this code (at some point in time many years ago). |