Index: lib/CodeGen/GlobalISel/LegalizerInfo.cpp =================================================================== --- lib/CodeGen/GlobalISel/LegalizerInfo.cpp +++ lib/CodeGen/GlobalISel/LegalizerInfo.cpp @@ -75,8 +75,11 @@ // Nothing is going to go well with types that aren't a power of 2 yet, so // don't even try because we might make things worse. - if (!isPowerOf2_64(Aspect.Type.getSizeInBits())) - return std::make_pair(Unsupported, LLT()); + LLT Ty = Aspect.Type; + unsigned SizeInBits = + Ty.isVector() ? Ty.getElementType().getSizeInBits() : Ty.getSizeInBits(); + if (!isPowerOf2_64(SizeInBits)) + return std::make_pair(Unsupported, LLT()); // FIXME: the long-term plan calls for expansion in terms of load/store (if // they're not legal). @@ -91,7 +94,6 @@ return findLegalAction(Aspect, Action); unsigned Opcode = Aspect.Opcode; - LLT Ty = Aspect.Type; if (!Ty.isVector()) { auto DefaultAction = DefaultActions.find(Aspect.Opcode); if (DefaultAction != DefaultActions.end() && DefaultAction->second == Legal)