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

Evan Cheng evan.cheng at apple.com
Sun Sep 7 17:19:07 PDT 2008


Is this fixing a bug? getNode should be performing constant folding.  
See SelectionDAG.cpp line 2441. If somehow that wasn't happening,  
please fix it there and provide a test case.

Thanks,

Evan

On Sep 7, 2008, at 4:34 AM, Bill Wendling wrote:

> Author: void
> Date: Sun Sep  7 06:34:47 2008
> New Revision: 55886
>
> URL: http://llvm.org/viewvc/llvm-project?rev=55886&view=rev
> Log:
> Convert
>
>    // fold (sub c1, c2) -> c1-c2
>
> from a no-op into an actual transformation.
>
> 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=55886&r1=55885&r2=55886&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sun Sep  7  
> 06:34:47 2008
> @@ -1111,7 +1111,7 @@
>     return DAG.getConstant(0, N->getValueType(0));
>   // fold (sub c1, c2) -> c1-c2
>   if (N0C && N1C)
> -    return DAG.getNode(ISD::SUB, VT, N0, N1);
> +    return DAG.getConstant(N0C->getAPIntValue() - N1C- 
> >getAPIntValue(), VT);
>   // fold (sub x, c) -> (add x, -c)
>   if (N1C)
>     return DAG.getNode(ISD::ADD, VT, N0,
>
>
> _______________________________________________
> 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