[LLVMdev] equivalent IR, different asm
dalej at apple.com
Wed Sep 1 11:14:54 PDT 2010
On Sep 1, 2010, at 6:25 AMPDT, Argyrios Kyrtzidis wrote:
> The attached .ll files seem equivalent, but the resulting asm from
> 'opt-fail.ll' causes a crash to webkit.
> I suspect the usage of registers is wrong, can someone take a look ?
Yes, the code here is wrong:
> movl (%rbx), %ecx
> imull %ecx, %eax
This computes h*((int32)%1) in %eax.
> shrq $32, %rax
> movl %eax, %ecx
This is trying to compute (int32)(%1>>32) into %ecx, but is using the
wrong input value since %rax has been clobbered by the above code, and
further is clobbering the value in %eax computed above, which is
implicit input to the divide. This is some kind of back end error,
probably register allocator.
> idivl %ecx
More information about the llvm-dev