[LLVMdev] "equivalent" .ll files diverge after optimizations are applied

Argyrios Kyrtzidis kyrtzidis at apple.com
Tue Aug 31 11:18:42 PDT 2010


Hi,

I've attached 2 .ll files which are supposed to be equivalent but 'unopt-fail.ll' causes a crash in webkit's test suite while 'unopt-pass.ll' does not. I can't give more details about the crash, when I run the crashing test it in isolation it passes, when I run the full suite it crashes; it boggles the mind.

Below I provide the optimized asm that is produced from each file. Could you give a hint on what is the problem ?
I also attached 't.cpp' which approximates the source that the .ll files came from.

-Argiris


-------------- next part --------------
A non-text attachment was scrubbed...
Name: unopt-fail.ll
Type: application/octet-stream
Size: 15313 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100831/9782fea6/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unopt-pass.ll
Type: application/octet-stream
Size: 17832 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100831/9782fea6/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.cpp
Type: application/octet-stream
Size: 447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100831/9782fea6/attachment-0002.obj>
-------------- next part --------------



$ opt -std-compile-opts unopt-pass.ll -o - | llc -o -

	.section	__TEXT,__text,regular,pure_instructions
	.globl	__ZN7WebCore15GraphicsContext19roundToDevicePixelsERKNS_9FloatRectE
	.align	4, 0x90
__ZN7WebCore15GraphicsContext19roundToDevicePixelsERKNS_9FloatRectE: ## @_ZN7WebCore15GraphicsContext19roundToDevicePixelsERKNS_9FloatRectE
## BB#0:
	subq	$24, %rsp
	movq	%rsi, %rdx
	movl	$0, 16(%rsp)
	movl	$0, 20(%rsp)
	movl	$0, 8(%rsp)
	movl	$0, 12(%rsp)
	movq	8(%rdi), %rsi
	leaq	16(%rsp), %rcx
	leaq	8(%rsp), %r8
	callq	__ZN7WebCore5mouniEPNS_15GraphicsContextEPNS_30GraphicsContextPlatformPrivateERKNS_9FloatRectERNS_10FloatPointES8_
	movss	8(%rsp), %xmm1
	movss	12(%rsp), %xmm0
	subss	20(%rsp), %xmm0
	subss	16(%rsp), %xmm1
                                        ## kill: XMM1<def> XMM1<kill> XMM1<def>
	insertps	$16, %xmm0, %xmm1 ## xmm1 = xmm1[0],xmm0[0],xmm1[2,3]
	movq	16(%rsp), %xmm0
	addq	$24, %rsp
	ret


$ opt -std-compile-opts unopt-fail.ll -o - | llc -o -

	.section	__TEXT,__text,regular,pure_instructions
	.globl	__ZN7WebCore15GraphicsContext19roundToDevicePixelsERKNS_9FloatRectE
	.align	4, 0x90
__ZN7WebCore15GraphicsContext19roundToDevicePixelsERKNS_9FloatRectE: ## @_ZN7WebCore15GraphicsContext19roundToDevicePixelsERKNS_9FloatRectE
## BB#0:
	subq	$24, %rsp
	movq	%rsi, %rdx
	movl	$0, 16(%rsp)
	movl	$0, 20(%rsp)
	movl	$0, 8(%rsp)
	movl	$0, 12(%rsp)
	movq	8(%rdi), %rsi
	leaq	16(%rsp), %rcx
	leaq	8(%rsp), %r8
	callq	__ZN7WebCore5mouniEPNS_15GraphicsContextEPNS_30GraphicsContextPlatformPrivateERKNS_9FloatRectERNS_10FloatPointES8_
	movss	8(%rsp), %xmm0
	movss	12(%rsp), %xmm1
	subss	20(%rsp), %xmm1
	subss	16(%rsp), %xmm0
	insertps	$16, %xmm1, %xmm0 ## xmm0 = xmm0[0],xmm1[0],xmm0[2,3]
	movd	%xmm0, %rax
	movd	%rax, %mm0
	movq2dq	%mm0, %xmm1
	movq2dq	%mm0, %xmm2
	punpcklqdq	%xmm2, %xmm1    ## xmm1 = xmm1[0],xmm2[0]
	movq	16(%rsp), %rax
	movd	%rax, %mm0
	movq2dq	%mm0, %xmm0
	punpcklqdq	%xmm2, %xmm0    ## xmm0 = xmm0[0],xmm2[0]
	addq	$24, %rsp
	ret



More information about the llvm-dev mailing list