It is not useful to report WidenScalar for a pointer value, so always
report a scalar value with the target size. This allows using this to
clamp the scalar operand to the pointer size in operations like
G_PTR_ADD or G_PTRMASK.
Query.Types[TypeIdx].getSizeInBits();
},
[=](const LegalityQuery &Query) {
- LLT T = Query.Types[LargeTypeIdx];
- return std::make_pair(TypeIdx,
- T.isVector() ? T.getElementType() : T);
+ const LLT Ty = Query.Types[TypeIdx];
+ const LLT LargeTy = Query.Types[LargeTypeIdx];
+ LLT NewEltTy = LLT::scalar(LargeTy.getScalarSizeInBits());
+ return std::make_pair(TypeIdx, Ty.changeElementType(NewEltTy));
});
}