[PATCH] Teach BaseIndexOffset::match to identify base pointers in loops

Eric Christopher echristo at gmail.com
Wed Aug 28 15:20:10 PDT 2013


Haven't looked to see if it was ever committed (it also LGTM and
awesome for the better comments), one style nit:

+    if (Ptr->getOperand(1)->getOpcode() == ISD::MUL) {
+      return BaseIndexOffset(Ptr, SDValue(), 0, IsIndexSignExt);
+    }

No need for braces here I don't think.

-eric


On Wed, Aug 21, 2013 at 2:44 PM, Juergen Ributzka <juergen at apple.com> wrote:
> Hi @ll,
>
> the small utility function that pattern matches Base + Index + Offset patterns for loads and stores fails to recognize the base pointer for loads/stores from/into an array at offset 0 inside a loop. As a result DAGCombiner::MergeConsecutiveStores was not able to merge all stores.
>
> Example:
> for(int i=0; i <N; i+=4) {
>         a[i+0] = 1;
>         a[i+1] = 1;
>         a[i+2] = 1;
>         a[i+3] = 1;
> }
>
> In this example BaseIndexOffset::match would identify a different base pointer for a[i+0] then for all the others.
>
> This small patch adds an additional pattern match to recognize this special case and a test case.
>
> Cheers,
> Juergen
>
>
> _______________________________________________
> 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