[llvm-commits] [PATCH] align constant pool loads using preferred alignment

Dan Gohman gohman at apple.com
Tue Sep 16 15:02:25 PDT 2008


Committed, thanks! I did make a few cosmetic changes to
enforce our 80-column limit.

I was surprised to see that ConstantPoolSDNode's alignment
argument is a log2 value, but that apparently what that
code is expecting.

It looks like the code in ScheduleDAGEmit.cpp that handles
the alignment==0 case for ConstantPoolSDNode is no longer
needed. Does that seem right to you?

Thanks,

Dan

On Sep 16, 2008, at 11:07 AM, Paul Redmond wrote:

> Hi,
>
> As suggested by Dan Gohman:
>
> This patch changes SelectionDAG::getConstantPool to always set the  
> alignment of the ConstantPoolSDNode using the target's preferred  
> alignment for the constant type.
>
> In LegalizeDAG, when performing loads from the constant pool, the  
> ConstantPoolSDNode's alignment is used in the calls to getLoad and  
> getExtLoad.
>
> This change prevents SelectionDAG::getLoad/getExtLoad from  
> incorrectly choosing the ABI alignment for constant pool loads when  
> Alignment == 0. The incorrect alignment is only a performance issue  
> when ABI alignment does not equal preferred alignment (i.e., on x86  
> it was generating MOVUPS instead of MOVAPS for v4f32 constant loads  
> when the default ABI alignment for 128bit vectors is forced to 1  
> byte.)
>
> thanks,
> Paul
> <const_pref_align.diff>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list