[llvm] [SimplifyCFG] Fix Missing Case Computation for Arbitrary Width Integers (PR #77831)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 13:18:29 PST 2024


dtcxzyw wrote:

> > I don't think it is worth handing `switch i128` cases. We can early exit if the bit width of condition value is larger than 64:
> > ```
> >   auto *CondTy = cast<IntegerType>(SI->getCondition()->getType());
> >   if (CondTy->getIntegerBitWidth() > 64 ||
> >       !DL.fitsInLegalInteger(CondTy->getIntegerBitWidth()))
> >     return false;
> > ```
> 
> Thanks for the fast response @dtcxzyw ! I can certainly implement the early escape. Could you help me understand why it is not worth handling conditions of wider widths?

+ `switch i128` is rare in real code.
+ It is impossible to convert it into jump table.


https://github.com/llvm/llvm-project/pull/77831


More information about the llvm-commits mailing list