[PATCH] D31914: [DAGCombine]: Fix for regression I brought up in D31068

Aditya Nandakumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 17:15:12 PDT 2017


aditya_nandakumar created this revision.

This is in continuation of https://reviews.llvm.org/D31068 for addressing a regression that I was seeing in our internal backends.

The DAG looks like this
t0: ch = EntryToken

        t8: i64 = add t6, Constant:i64<2>
      t12: ch = store<ST1[%dst.gep2.i105.2](align=2)> t0, Constant:i8<0>, t8, undef:i64
      t14: i64 = add t6, Constant:i64<3>
    t15: ch = store<ST1[%dst.gep2.i105.3]> t12, Constant:i8<0>, t14, undef:i64
    t17: i64 = add t6, Constant:i64<4>
  t18: ch = store<ST1[%dst.gep2.i105.4](align=2)> t15, Constant:i8<0>, t17, undef:i64
    t20: i64 = add t6, Constant:i64<5>
  t50: ch = store<ST1[%dst.gep2.i105.5]> t0, Constant:i8<0>, t20, undef:i64

When trying to merge t50, we'd need to walk the chain (Entry t0) and then the uses of the EntryToken and consecutively follow the uses if we keep seeing stores and add that to the worklist.
For reference, before the change in 297695, the DAG looked like

          t8: i64 = add t6, Constant:i64<2>
        t12: ch = store<ST1[%dst.gep2.i105.2](align=2)> t0, Constant:i8<0>, t8, undef:i64
        t14: i64 = add t6, Constant:i64<3>
      t15: ch = store<ST1[%dst.gep2.i105.3]> t12, Constant:i8<0>, t14, undef:i64
      t17: i64 = add t6, Constant:i64<4>
    t18: ch = store<ST1[%dst.gep2.i105.4](align=2)> t15, Constant:i8<0>, t17, undef:i64
    t20: i64 = add t6, Constant:i64<5>
  t21: ch = store<ST1[%dst.gep2.i105.5]> t18, Constant:i8<0>, t20, undef:i64

It was straightforward to find candidates for merging stores.

I quickly threw in a hack for the above (extending what was in https://reviews.llvm.org/D31068) and this fixes the regression that I saw.
Looking forward to your comments/feedback.


Repository:
  rL LLVM

https://reviews.llvm.org/D31914

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31914.94755.patch
Type: text/x-patch
Size: 9275 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170411/b895af1b/attachment.bin>


More information about the llvm-commits mailing list