[PATCH] D41654: [PowerPC] Add an ISD::TRUNCATE to the legalization for ppc_is_decremented_ctr_nonzero
Hal Finkel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 6 20:28:51 PST 2018
hfinkel accepted this revision.
hfinkel added a comment.
This revision is now accepted and ready to land.
> In this case the intrinsic returns i1 and the legalization promotes it to i32, but we need to return an i1, to insert a truncate back to i1. The new truncate will get added to worklist and end up being legalized itself, but won't require custom legalization.
It seems like there are two relevant cases. When crbits are enabled, then i1 is a legal type and getSetCCResultType should return i1. In this case, the truncate will be between i1 and i1 and should be removed (SelectionDAG::getNode does this). Otherwise, getSetCCResultType will be i32 and the legalizer will promote the truncate to be i32 -> i32 which will be similarly removed. Thus, this seems fine.
More information about the llvm-commits