Page MenuHomePhabricator

[LoopVectorizer] Fixed a bug in gather/scatter intrinsics.

Authored by delena on Jul 6 2016, 12:48 AM.



The bug was in building vector GEP before gather scatter.
Index of GEP may remain scalar if it is nit defined inside the loop. (isLoopInvariant() condition is not enough).

The patch fixes

You see a lot of insert/extract instructions inside the test. I'll optimize this in the next patch.

Diff Detail


Event Timeline

delena updated this revision to Diff 62828.Jul 6 2016, 12:48 AM
delena retitled this revision from to [LoopVectorizer] Fixed a bug in gather/scatter intrinsics..
delena updated this object.
delena added a reviewer: Ayal.
delena set the repository for this revision to rL LLVM.
delena added subscribers: llvm-commits, sanjoy.
delena updated this revision to Diff 62855.Jul 6 2016, 6:28 AM

Changed form of the code, NFC.

Ayal edited edge metadata.Jul 6 2016, 6:59 AM

This looks good to me, with minor nits.

2696–2697 ↗(On Diff #62855)

Better emphasize that:
we want to get a vector value for base and each index that's defined inside the loop, even if it is loop-invariant but wasn't hoisted out. Otherwise we want to keep them scalar.

2703–2705 ↗(On Diff #62855)

Can simply keep the original OpsV.push_back(VectorParts(UF, Op)), right?

2714 ↗(On Diff #62855)

Just noting that this is an independent, obvious, fix.

12 ↗(On Diff #62855)

Indicate more clearly what this test is designed to check for?

This revision was automatically updated to reflect the committed changes.