This is an archive of the discontinued LLVM Phabricator instance.

Add a new reduction pattern match
ClosedPublic

Authored by masakazu.ueno on Nov 12 2018, 10:55 PM.

Details

Summary

Adding a new reduction pattern match for vectorizing code similar to TSVC s3111:

for (int i = 0; i < N; i++)

if (a[i] > b)
  sum += a[i];

This patch adds support for fadd, fsub and fmull, as well as multiple
branches and different (but compatible) instructions (ex. add+sub) in
different branches.

The difference from the previous patch(https://reviews.llvm.org/D49168) is as follows.

  • Added check of fast-math property of fp-instruction to the previous patch.
  • Fix/add some pattern for if-reduction.ll.

Diff Detail

Event Timeline

masakazu.ueno created this revision.Nov 12 2018, 10:55 PM

@Carrot, can you check if this fixes the fast math issues on your side, please?

rengolin accepted this revision.Nov 30 2018, 5:42 AM

Accepting as this seems to fix the fast-math issue that was the reason why we reverted. Let me know if this still breaks things.

This revision is now accepted and ready to land.Nov 30 2018, 5:42 AM
This revision was automatically updated to reflect the committed changes.