------- Comment #2 from jv244 at cam dot ac dot uk  2008-11-19 13:18 -------
(In reply to comment #1)
> Do you know of any compilers that catch this?  As you say, it is not so easy 
> to
> fix.

I believe ifort gets this right (compiled with 'ifort -S -heap-arrays 64), but
this is just looking at the assembly, which normally contains calls to
for_allocate if a temp is generated:

s1_:
# parameter 1: %rdi
..B1.1:                         # Preds ..B1.0
..___tag_value_s1_.1:                                           #1.12
        movq      48(%rdi), %rsi                                #4.1
        movl      $1, %r8d                                      #4.1
        testq     %rsi, %rsi                                    #4.1
        jle       ..B1.5        # Prob 10%                      #4.1
                                # LOE rbx rbp rsi rdi r8 r12 r13 r14 r15
..B1.2:                         # Preds ..B1.1
        movq      (%rdi), %rax                                  #4.1
        movq      56(%rdi), %rcx                                #4.1
        movq      %rcx, %rdx                                    #4.1
        subq      %rcx, %rax                                    #
                                # LOE rax rdx rcx rbx rbp rsi r8 r12 r13 r14
r15
..B1.3:                         # Preds ..B1.3 ..B1.2
        movl      %r8d, (%rdx,%rax)                             #4.1
        addq      %rcx, %rdx                                    #4.1
        addq      $1, %r8                                       #4.1
        cmpq      %rsi, %r8                                     #4.1
        jle       ..B1.3        # Prob 82%                      #4.1
                                # LOE rax rdx rcx rbx rbp rsi r8 r12 r13 r14
r15
..B1.5:                         # Preds ..B1.3 ..B1.1
        ret                                                     #5.1
        .align    2,0x90


> 
> BTW you say that this another case where an unneeded temp is created.  I can
> see your PRs after this.  Which ones come before?

I've added a number of these as blocking PR36854. As mentioned before, all
derived from CP2K. I believe these are relatively important to fix, the
performance inpact of generating an unneeded temp can be very large.

Joost

> 
> Paul
> 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38111

Reply via email to