This is an archive of the discontinued LLVM Phabricator instance.

[x86] make pointer extractions from a vector more expensive (PR27826)
ClosedPublic

Authored by spatel on May 24 2016, 3:27 PM.

Details

Summary

Among possible other problems, we have a vector of induction variable pointers and no hardware gather support in PR27826:
https://llvm.org/bugs/show_bug.cgi?id=27826

We should adjust the cost model for pointer extracts from a vector because those values require a move to a GPR in order to be used as part of a load/store address.

Alternatively, we could add a penalty to getAddressComputationCost()? There is already a check for a vector operand there in the x86 override, but the penalty is only applied if the computation is specified with "IsComplex" by the caller.

When I tried adjusting that function, I got several regression test failures, so this patch is the path of least resistance. The PPC cost model does something similar to its getVectorInstrCost() to simulate the LHS penalty when moving values from FP/Int <--> VMX.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel updated this revision to Diff 58323.May 24 2016, 3:27 PM
spatel retitled this revision from to [x86] make pointer extractions from a vector more expensive (PR27826).
spatel updated this object.
spatel added reviewers: hfinkel, delena, nadav.
spatel added a subscriber: llvm-commits.

Nadav commented on the list, but it doesn't seem to have copied here in Phab:
"This looks like the right approach. LGTM."

Thanks! I'll try to come up with an example for the more general problem of trying to vectorize without HW gather support and open a new bug report.

This revision was automatically updated to reflect the committed changes.