<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/146769>146769</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[ConstantFolding][Intrinsics] Missed folding of poison in a few trivially vectorizable intrinsics
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
badumbatish
</td>
</tr>
</table>
<pre>
Per https://godbolt.org/z/68dTozY9r, we're not folding a few intrinsics that's trivially vectorizable.
Below's a list of folded and non-folded intrinsics (from godbolt)
```
; Intrinsic::abs: CORRECT // Begin integer bit-manipulation.
; Intrinsic::bswap: CORRECT
; Intrinsic::bitreverse: CORRECT
; Intrinsic::ctpop: CORRECT
; Intrinsic::ctlz: CORRECT
; Intrinsic::cttz: CORRECT
; Intrinsic::fshl: CORRECT
; Intrinsic::fshr: CORRECT
; Intrinsic::smax: CORRECT
; Intrinsic::smin: CORRECT
; Intrinsic::umax: CORRECT
; Intrinsic::umin: CORRECT
; Intrinsic::sadd_sat: CORRECT
; Intrinsic::ssub_sat: CORRRECY
; Intrinsic::uadd_sat: CORRECT
; Intrinsic::usub_sat: CORRECT
; Intrinsic::smul_fix: CORRECT
; Intrinsic::smul_fix_sat: CORRECT
; Intrinsic::umul_fix: MISS
; Intrinsic::umul_fix_sat: MISS
; Intrinsic::sqrt: CORRECT // Begin floating-point.
; Intrinsic::asin: MISS
; Intrinsic::acos: MISS
; Intrinsic::atan: MISS
; Intrinsic::atan2: MISS
; Intrinsic::sin: MISS
; Intrinsic::cos: MISS
; Intrinsic::sincos: MISS
; Intrinsic::sincospi: MISS
; Intrinsic::tan: MISS
; Intrinsic::sinh: MISS
; Intrinsic::cosh: MISS
; Intrinsic::tanh: MISS
; Intrinsic::exp: MISS
; Intrinsic::exp10: MISS
; Intrinsic::exp2: MISS
; Intrinsic::log: MISS
; Intrinsic::log10: MISS
; Intrinsic::log2: MISS
; Intrinsic::fabs: CORRECT
; Intrinsic::minnum: CORRECT
; Intrinsic::maxnum: CORRECT
; Intrinsic::minimum: CORRECT
; Intrinsic::maximum: CORRECT
; Intrinsic::minimumnum: CORRECT
; Intrinsic::maximumnum: CORRECT
; Intrinsic::modf: MISS
; Intrinsic::copysign: CORRECT
; Intrinsic::floor: MISS
; Intrinsic::ceil: MISS
; Intrinsic::trunc: MISS
; Intrinsic::rint: MISS
; Intrinsic::nearbyint: MISS
; Intrinsic::round: MISS
; Intrinsic::roundeven: MISS
; Intrinsic::pow: MISS
; Intrinsic::fma: CORRECT
; Intrinsic::fmuladd: CORRECT
; Intrinsic::is_fpclass: CORRECT
; Intrinsic::powi: MISS
; Intrinsic::canonicalize: CORRECT
; Intrinsic::fptosi_sat: CORRECT
; Intrinsic::fptoui_sat: CORRECT
; Intrinsic::lrint: MISS
; Intrinsic::llrint: MISS
; Intrinsic::ucmp: CORRECT
; Intrinsic::scmp: CORRECT
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUl0uP4jgQgH-Nc7FAxiE8DjkAPUhzGO2qZy5zalViJ9TKsbN-QDe_fhWge2kW2l4JCSG-fK7yI64C57DVUpakWJPiKYPgd8aWFYjQVeDR7bLKiLfyT2npzvvekXxF-JbwbWtEZZQfG9sSvj0Svp0txC9z_L20hG_oQRI-t5Jq42ljlEDdUqCNPFDU3qJ2WDvqd-AJnzvqLe4RlHqje1l7Y_EIlZJjStiKsNVaKnM4cUAVOk9Nc3JKQUELqo0eXX5euQlfNNZ09BIn4cuzjMzY5cNWlFJK8jX9_v7YkF2-gmpIk27-eH7-tvk1MKeM6Vq2qIcxZCstrdCPOtDYBwUejR6fhHd0lTtAfyUcuHsYeiv30jp5w96Da9-bW-d9Th2TMJ-CNW6n0jCbgLkOXpMw1AlYSLOFNJsDIV4c-BTUheoaff62-f1w9HRtuNF-OUNBvTSYNplnNDWIK_OP7z9_xrh37Tt7L4K_7fXIn89Wowx41O2oN6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