[llvm] r191989 - Fix DAGCombiner::visitFP_EXTEND to ignore indexed loads

Hal Finkel hfinkel at anl.gov
Fri Oct 4 15:25:48 PDT 2013


----- Original Message -----
> Author: hfinkel
> Date: Fri Oct  4 17:18:12 2013
> New Revision: 191989
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=191989&view=rev
> Log:
> Fix DAGCombiner::visitFP_EXTEND to ignore indexed loads
> 
> DAGCombiner::visitFP_EXTEND will apply the following transformation:
> 
>   fold (fpext (load x)) -> (fpext (fptrunc (extload x)))

FWIW, I don't understand why we're performing this transformation at all. It seems to have been in DAGCombine for many years, is it possible that it really should be target-specific?

 -Hal

> 
> but the implementation does not handle indexed loads (pre/post inc.),
> but did
> not specifically ignore them either (unlike for extending loads,
> which it
> already ignored), causing an assert when the transformation was
> applied to an
> indexed load. This is the minimal fix for correctness (causing the
> transformation to be skipped for indexed loads).
> 
> Unfortunately, I don't have an in-tree test case.
> 
> 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=191989&r1=191988&r2=191989&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Oct  4
> 17:18:12 2013
> @@ -6731,7 +6731,7 @@ SDValue DAGCombiner::visitFP_EXTEND(SDNo
>    }
>  
>    // fold (fpext (load x)) -> (fpext (fptrunc (extload x)))
> -  if (ISD::isNON_EXTLoad(N0.getNode()) && N0.hasOneUse() &&
> +  if (ISD::isNormalLoad(N0.getNode()) && N0.hasOneUse() &&
>        ((!LegalOperations && !cast<LoadSDNode>(N0)->isVolatile()) ||
>         TLI.isLoadExtLegal(ISD::EXTLOAD, N0.getValueType()))) {
>      LoadSDNode *LN0 = cast<LoadSDNode>(N0);
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list