[llvm-commits] [llvm] r118164 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Bob Wilson
bob.wilson at apple.com
Wed Nov 3 08:44:25 PDT 2010
This should be safe, but you could take it one step further and just return undef instead of creating a load from an undef pointer.
On Nov 3, 2010, at 2:36 AM, Eric Christopher wrote:
> Author: echristo
> Date: Wed Nov 3 04:36:40 2010
> New Revision: 118164
>
> URL: http://llvm.org/viewvc/llvm-project?rev=118164&view=rev
> Log:
> If we have an undef mask our Elt will be -1 for our access, handle
> this by using an undef as a pointer.
>
> Fixes rdar://8625016
>
> 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=118164&r1=118163&r2=118164&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Nov 3 04:36:40 2010
> @@ -6190,7 +6190,7 @@
> SDValue EltNo = N->getOperand(1);
>
> if (isa<ConstantSDNode>(EltNo)) {
> - unsigned Elt = cast<ConstantSDNode>(EltNo)->getZExtValue();
> + int Elt = cast<ConstantSDNode>(EltNo)->getZExtValue();
> bool NewLoad = false;
> bool BCNumEltsChanged = false;
> EVT VT = InVec.getValueType();
> @@ -6228,7 +6228,7 @@
>
> // Select the input vector, guarding against out of range extract vector.
> unsigned NumElems = VT.getVectorNumElements();
> - int Idx = (Elt > NumElems) ? -1 : SVN->getMaskElt(Elt);
> + int Idx = (Elt > (int)NumElems) ? -1 : SVN->getMaskElt(Elt);
> InVec = (Idx < (int)NumElems) ? InVec.getOperand(0) : InVec.getOperand(1);
>
> if (InVec.getOpcode() == ISD::BIT_CONVERT)
> @@ -6257,7 +6257,11 @@
>
> SDValue NewPtr = LN0->getBasePtr();
> unsigned PtrOff = 0;
> - if (Elt) {
> + // If Idx was -1 above, Elt is going to be -1, so just use undef as our
> + // new pointer.
> + if (Elt == -1) {
> + NewPtr = DAG.getUNDEF(NewPtr.getValueType());
> + } else if (Elt) {
> PtrOff = LVT.getSizeInBits() * Elt / 8;
> EVT PtrType = NewPtr.getValueType();
> if (TLI.isBigEndian())
>
>
> _______________________________________________
> 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