[PATCH] When canonicalizing gep indices, prefer zext when possible (SelectionDAGBuilder)

Philip Reames listmail at philipreames.com
Fri Feb 13 16:03:43 PST 2015


In http://reviews.llvm.org/D7626#123600, @hfinkel wrote:

> Part of the issue is that this canonicalization already exists in DAGCombine (at the end of DAGCombiner::visitSIGN_EXTEND):
>
>   // fold (sext x) -> (zext x) if the sign bit is known zero.
>   if ((!LegalOperations || TLI.isOperationLegal(ISD::ZERO_EXTEND, VT)) &&
>       DAG.SignBitIsZero(N0))
>     return DAG.getNode(ISD::ZERO_EXTEND, SDLoc(N), VT, N0);
>   
>
> As a result, I'm not sure this is needed.


I agree.  Given this, I find it really odd I saw the sign extensions to start with...  I suspect we're missing something here.

Until we figure out what that something is, I'm going to abandon this change for now.


http://reviews.llvm.org/D7626

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list