[llvm-commits] [llvm] r48140 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Chris Lattner clattner at apple.com
Mon Mar 10 11:44:57 PDT 2008


On Mar 10, 2008, at 12:59 AM, Evan Cheng wrote:
> Author: evancheng
> Date: Mon Mar 10 02:59:01 2008
> New Revision: 48140
>
> URL: http://llvm.org/viewvc/llvm-project?rev=48140&view=rev
> Log:
> Doh

I'm not sure if this is the right thing to do.  How about only doing  
this xform (x-x => 0) if before legalize or if the element is a  
scalar?  Alternatively, dag combiner should query the target to see if  
the result is valid, it shouldn't just disable it for build vectors.

-Chris

>
>
> Modified:
>    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=48140&r1=48139&r2=48140&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Mar 10  
> 02:59:01 2008
> @@ -1102,12 +1102,13 @@
>   }
>
>   // fold (sub x, x) -> 0
> -  if (N0 == N1)
> +  if (N0 == N1) {
>     if (ISD::isBuildVectorAllZeros(N0.Val))
>       // Zero vectors might be normalized to a particular vector  
> type to ensure
>       // they are CSE'd. Return it as it is.
>       return N0;
>     return DAG.getConstant(0, N->getValueType(0));
> +  }
>   // fold (sub c1, c2) -> c1-c2
>   if (N0C && N1C)
>     return DAG.getNode(ISD::SUB, VT, N0, N1);
>
>
> _______________________________________________
> 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