[llvm] r214953 - [x86] Switch to a formulation of a for loop that is much more obviously

David Blaikie dblaikie at gmail.com
Wed Aug 6 09:53:15 PDT 2014


On Wed, Aug 6, 2014 at 3:16 AM, Chandler Carruth <chandlerc at gmail.com> wrote:
> Author: chandlerc
> Date: Wed Aug  6 05:16:33 2014
> New Revision: 214953
>
> URL: http://llvm.org/viewvc/llvm-project?rev=214953&view=rev
> Log:
> [x86] Switch to a formulation of a for loop that is much more obviously
> not corrupting the mask by mutating it more times than intended. No
> functionality changed (the results were non-overlapping so the old
> version "worked" but was non-obvious).

Sorry - I seem to be missing the non-obviousness you're referring to.
Which results were non-overlapping?

>
> Modified:
>     llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
>
> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=214953&r1=214952&r2=214953&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Aug  6 05:16:33 2014
> @@ -7519,9 +7519,10 @@ static SDValue lowerV8I16SingleInputVect
>      int FreeDWord = (PSHUFDMask[DestOffset / 2] == -1 ? 0 : 1) + DestOffset / 2;
>      assert(PSHUFDMask[FreeDWord] == -1 && "DWord not free");
>      PSHUFDMask[FreeDWord] = IncomingInputs[0] / 2;
> -    for (int Input : IncomingInputs)
> -      std::replace(HalfMask.begin(), HalfMask.end(), Input,
> -                   FreeDWord * 2 + Input % 2);
> +    for (int &M : HalfMask)
> +      for (int Input : IncomingInputs)
> +        if (M == Input)
> +          M = FreeDWord * 2 + Input % 2;
>    };
>    moveInputsToRightHalf(HToLInputs, LToLInputs, PSHUFHMask, LoMask,
>                          /*SourceOffset*/ 4, /*DestOffset*/ 0);
>
>
> _______________________________________________
> 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