<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/112510>112510</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Resolve implicit trunc TODOs
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nikic
</td>
</tr>
</table>
<pre>
https://github.com/llvm/llvm-project/pull/106524 introduces a consistency assertion in the APInt constructor (currently still disabled by default), which verifies that the passed value is indeed a signed/unsigned value of the indicated bit width.
To allow this assertion to be enabled by default, a number of `// TODO: Avoid implicit trunc?` comments were left behind, in cases where it was not immediately clear whether/how the implicit truncation in the APInt constructor could be avoided.
Long term, these should be resolved in one three ways:
* Determine that the implicit truncation is actually desirable/acceptable in the given context. Replace the TODO with a comment explaining why.
* Change the code to avoid passing values that require implicit truncation.
* Make an API change, e.g. by propagating the implicitTrunc parameter up, so that some users can use it and some not. Or by accepting an APInt instead of a plain integer and leaving the proper construction to callers.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVNGO47YO_RrlhbiGrWQyyYMfcmcQoECLKRbzA7TEWOzKkivRyebvC8kz2HS7KNCXxAbJw8PDY2LOPAaiXj39Xz29bnARF1Mf-CubzRDtvXcic1bbk9Jnpc8ji1uGxsRJ6bP318-__80p_kFGlD7Pi_dKn7t2_6R3wEFStIuhDAgmhsxZKJg7YM6UhGMADiCO4PT7L0FqiqTFSEyg9MEsKVEQf4cs7D1Yzjh4sjDcwdIFFy9KH5V-gZtj4-BKiS9MGcShVNi5NLJwRb8QcAYOlsgCQh3cKn1ewvr4kRMvtY6DZYNSWrHAja24RrWvqj2tv-8R0Pt4A3GcH6aRCAMBhX_SfAGEsEwDpdJD7dtVUnh_e31T2xOcrpEt8DR7NiwgaQlGbc9q34KJ00RBMtwoEXi6CAzkONiCygEMZspwcyVa2GKGEAV4msgyCvk7GE-YSoo4SkqfXaVOP_TDf9-IiYu3ZT4sXMn-TZFfYxhBKE2FlDjKBNl9FiTK0V_JFuwYCMQlIrjhvXrrAQWUPsErFRyueR97_CnPDGhkQe-LzJlTEV3pMxpDs5SXz1FGvlIoowh9kwa-0OzRUA0V-eHG4qpBq85A32aPHDiMcHP35oHZi8MwroUmWirrrlpUn5X8aqIP_yX6c-H0U-6PmL_hVwIMRW8wFb8oSM3YFP_MKc44ohTwRyHeCxbMmHAqasEyl6oc19Y5TgRLppTBYChPxRgY7BoJURp4SwV_FaugrxSCAIcshLbYFKEqUb5jGilVBE94_WRT2FH6bpKPT8Cg95Rys7H91h63R9xQ3z3rY_vc7Y564_qDIWt2-2F32T0Pz7v95djtnw9Pg97i4aDxuOFet3rXtd2-PW4PnW6Gy4G0OdABLwfqjnu1a2lC9k25P01M44ZzXqjvOv3UtRuPA_lc75rWgW5Qo0rrcuZSX4_WsIxZ7VrPWfJ3GGHx1H9ZDfvD7qpb8mZJ_r8fxkogl9O4Mrz2-q8AAAD__5rt4rI">