[Transform] Rewrite LowerSwitch using APInt
authorPeter Rong <PeterRong96@gmail.com>
Thu, 29 Dec 2022 00:51:07 +0000 (16:51 -0800)
committerPeter Rong <PeterRong96@gmail.com>
Thu, 5 Jan 2023 22:30:42 +0000 (14:30 -0800)
commit1db51d8eb2d220a4f0000555ada310990098cf5b
treeee32c8ba0b9a32e23805542cdec9d7351ca65ab0
parentc3ab6455e5ad24fa8e9310b94bcce4a94b8489aa
[Transform] Rewrite LowerSwitch using APInt

This rewrite fixes https://github.com/llvm/llvm-project/issues/59316.

Previously LowerSwitch uses int64_t, which will crash on case branches using integers with more than 64 bits.
Using APInt fixes this problem. This patch also includes a test

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D140747
llvm/lib/Transforms/Utils/LowerSwitch.cpp
llvm/test/Transforms/LowerSwitch/pr59316.ll [new file with mode: 0644]