[llvm] [InstCombine] support trunc condition in foldSelectICmpAndAnd (PR #220690)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 6 14:05:14 PDT 2026
dtcxzyw wrote:
> the miscompilation is a legacy fault but can fix it here also but shall we either not allow any poison in the shift or check that the same element in FVal is poison like
>
> ```
> if (HasShift && isa<FixedVectorType>(SelType)) {
> auto *C1 = cast<Constant>(FVal);
> auto *C2 = cast<Constant>(Z);
> unsigned E = cast<FixedVectorType>(SelType)->getNumElements();
> for (unsigned I = 0; I != E; ++I) {
> if (isa<PoisonValue>(C1->getAggregateElement(I)) !=
> isa<PoisonValue>(C2->getAggregateElement(I)))
> return nullptr;
> }
> }
> ```
I don't think it is worth the complexity. Just add a variant like `m_SpecificInt_ICMP_ForbidPoison`.
https://github.com/llvm/llvm-project/pull/220690
More information about the llvm-commits
mailing list