[llvm-dev] Clang Optimizer freaks out on "simple" goto code?

Roel Jordans via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 6 06:49:51 PST 2016



On 05-12-16 18:06, Stephen Checkoway via llvm-dev wrote:
>> On Dec 5, 2016, at 06:08, Philip Pfaffe via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>>
>> While Clang's code is significantly larger,  that is probably on purpose: Clang has vectorized the goto-loop.
> Even with -mno-sse (and I suspect there's a better way to inhibit vectorization, but this worked), it looks like Clang is doing something a little strange. Where gcc uses
I think that the 'official' way would be to provide -fno-vectorize

Cheers,
  Roel

> .L7:
> 	add	eax, edi
> 	sub	edi, 1;
> 	jne	.L7,
>
> Clang has
>
> .LBB0_2:
> 	add	eax, edi
> 	cmp	edi, 1
> 	lea	ecx, [rdi - 1]
> 	mov	edi, ecx
> 	jg	.LBB0_2
>
> It also has a redundant xor eax, eax before the loop for some reason. That said...
>
>> To validate whether that was correct and a good idea, plug both results into a benchmark and look at the actual performance data.
> I didn't actually do this.
>



More information about the llvm-dev mailing list