This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombine]: Fix for regression I brought up in D31068
Needs ReviewPublic

Authored by aditya_nandakumar on Apr 10 2017, 5:15 PM.

Details

Reviewers
bogner
niravd
Summary

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 D31068) and this fixes the regression that I saw.
Looking forward to your comments/feedback.

Diff Detail

Repository
rL LLVM

Event Timeline

niravd resigned from this revision.May 8 2018, 8:53 AM

I suspect the underlying issue is no longer important, but for reference D31068 is a cleaned up version of this.