This is an archive of the discontinued LLVM Phabricator instance.

Loop with masked store - bugfix
ClosedPublic

Authored by delena on Apr 26 2016, 5:08 AM.

Details

Summary

Fixed a bug in loop vectorization with conditional store.
The following loop should be easily vectorized on targets with masked store:

unsigned int a[256], b[256];
void foo() {
  for (int i = 0; i < 256; i++) {
    if (b[i] > a[i]) 
      a[i] = b[i];
  }
}

The loop in the example calculates MAX value.
In the future, this loop should produce PMAX + store. But in the current version the function remains scalar due to the bug in masked store.
Any other loop without MAX pattern needs this fix anyway.

Diff Detail

Repository
rL LLVM

Event Timeline

delena updated this revision to Diff 54994.Apr 26 2016, 5:08 AM
delena retitled this revision from to Loop with masked store - bugfix.
delena updated this object.
delena added reviewers: Ayal, hfinkel, anemet.
delena set the repository for this revision to rL LLVM.
delena added subscribers: llvm-commits, mzolotukhin, dorit.
hfinkel accepted this revision.Apr 26 2016, 6:18 AM
hfinkel edited edge metadata.

LGTM

This revision is now accepted and ready to land.Apr 26 2016, 6:18 AM

Thanks a lot, Hal!

This revision was automatically updated to reflect the committed changes.