This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Fix assertion due to assuming a type is simple.
ClosedPublic

Authored by sfertile on Jan 4 2018, 8:41 PM.

Details

Summary

The CTRLoop pass performs checks on the argument of certain libcalls/intrinsics, and assumes the arguments must be of a simple type. This isn't always the case though. For example if we unroll and vectorize a loop we may end up with vectors larger then the largest legal type, along with intrinsics that operate on those wider types. This happened in the ffmpeg build, where we unrolled a loop and ended up with a sqrt intrinsic that operated on V16f64, triggering an assertion.

Diff Detail

Repository
rL LLVM

Event Timeline

sfertile created this revision.Jan 4 2018, 8:41 PM
nemanjai accepted this revision.Jan 5 2018, 2:12 PM

OK, I don't think there's an issue with this - if the vector just happens to be wider, we'll end up needing more of the respective instructions, but it won't turn anything into a library call that wouldn't be a library call otherwise.
LGTM.

lib/Target/PowerPC/PPCCTRLoops.cpp
407 ↗(On Diff #128709)

Nit: I imagine it was probably clang-format that formatted this so, but I would say that putting the entire initialization expression on a separate line is probably more readable.

This revision is now accepted and ready to land.Jan 5 2018, 2:12 PM
hfinkel accepted this revision.Jan 6 2018, 9:32 PM
hfinkel added inline comments.
lib/Target/PowerPC/PPCCTRLoops.cpp
409 ↗(On Diff #128709)

You should just be able to write:

if (EVTy == MVT::Other)

(otherwise, this LGTM too)

This revision was automatically updated to reflect the committed changes.