[llvm-commits] [llvm] r76153 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/Alpha/2009-07-16-PromoteFloatCompare.ll

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Jul 17 01:00:10 PDT 2009


On 17/07/2009, at 07.16, Eli Friedman wrote:

> Author: efriedma
> Date: Fri Jul 17 00:16:04 2009
> New Revision: 76153
>
> URL: http://llvm.org/viewvc/llvm-project?rev=76153&view=rev
> Log:
> Make promotion in operation legalization for SETCC work correctly.

This is great! I have been working on a patch to allow promotion of  
integer SETCC. It is almost identical to yours.

When promoting an integer SETCC, there is a further problem:  
LegalizeOps happily promotes the operator, but the following DAG  
combiner run flips it back again - the promoted SETCC is matched by  
TargetLowering::SimplifySetCC().

Would it be OK to add a isBeforeLegalizeOps() method on  
DagCombinerInfo? Then SimplifySetCC could check first:

if (DCI.isBeforeLegalizeOps() || isOperationLegalOrCustom(ISD::SETCC,  
newVT))
   ...replace SETCC node

> Added:
>    llvm/trunk/test/CodeGen/Alpha/2009-07-16-PromoteFloatCompare.ll
> Modified:
>    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=76153&r1=76152&r2=76153&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jul 17  
> 00:16:04 2009
> @@ -2973,7 +2973,8 @@
>                                        SmallVectorImpl<SDValue>  
> &Results) {
>   MVT OVT = Node->getValueType(0);
>   if (Node->getOpcode() == ISD::UINT_TO_FP ||
> -      Node->getOpcode() == ISD::SINT_TO_FP) {
> +      Node->getOpcode() == ISD::SINT_TO_FP ||
> +      Node->getOpcode() == ISD::SETCC) {
>     OVT = Node->getOperand(0).getValueType();

There is also an issue with SELECT_CC and BR_CC here. I guess we can  
add that when somebody needs it.

/jakob




More information about the llvm-commits mailing list