[PATCH] D11377: x86: check hasOpaqueSPAdjustment in canRealignStack

JF Bastien jfb at chromium.org
Mon Jul 20 17:12:48 PDT 2015


jfb added a comment.

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?


http://reviews.llvm.org/D11377







More information about the llvm-commits mailing list