Page MenuHomePhabricator

GlobalISel: Add helper to LLT to get a scalar or vector
ClosedPublic

Authored by arsenm on Jan 23 2019, 1:33 PM.

Diff Detail

Event Timeline

arsenm created this revision.Jan 23 2019, 1:33 PM
arsenm updated this revision to Diff 183168.Jan 23 2019, 1:40 PM

Add a second version

Could you add a test to unittests/CodeGen/LowLevelTypeTest.cpp?

include/llvm/Support/LowLevelTypeImpl.h
79

This can be replaced with:

return scalarOrVector(NumElements, LLT::scalar(ScalarSize));
paquette added inline comments.Jan 23 2019, 1:51 PM
include/llvm/Support/LowLevelTypeImpl.h
73

What happens if NumElements == 0? Seems good to assert that it's greater than 0 in both functions, unless a vector of 0 elements is the desired behaviour.

arsenm marked an inline comment as done.Jan 23 2019, 1:52 PM
arsenm added inline comments.
include/llvm/Support/LowLevelTypeImpl.h
73

I think that would be redundant with the assert in vector()

arsenm updated this revision to Diff 183174.Jan 23 2019, 2:08 PM

Simplify, add test

This revision is now accepted and ready to land.Jan 24 2019, 3:32 PM
arsenm closed this revision.Jan 24 2019, 4:10 PM

r352136