[all-commits] [llvm/llvm-project] b818da: [SimplifyCFG] Enable switch to lookup table for mo...
Craig Topper via All-commits
all-commits at lists.llvm.org
Tue Aug 3 15:36:06 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b818da27ab6d7b1f02cbfc402fa1cae2c5677788
https://github.com/llvm/llvm-project/commit/b818da27ab6d7b1f02cbfc402fa1cae2c5677788
Author: Craig Topper <craig.topper at sifive.com>
Date: 2021-08-03 (Tue, 03 Aug 2021)
Changed paths:
M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
M llvm/test/Transforms/SimplifyCFG/RISCV/switch_to_lookup_table-rv32.ll
M llvm/test/Transforms/SimplifyCFG/RISCV/switch_to_lookup_table-rv64.ll
M llvm/test/Transforms/SimplifyCFG/rangereduce.ll
Log Message:
-----------
[SimplifyCFG] Enable switch to lookup table for more types.
This transform has been restricted to legal types since
https://reviews.llvm.org/rG65df808f6254617b9eee931d00e95d900610b660
in 2012.
This is particularly restrictive on RISCV64 which only has i64
as a legal integer type. i32 is a very common type in code
generated from C, but we won't form a lookup table with it.
This also effects other common types like i8/i16 types on ARM,
AArch64, RISCV, etc.
This patch proposes to allow power of 2 types larger than 8 bit, if
they will fit in the largest legal integer type in DataLayout.
These types are common in C code so generally well handled in
the backends.
We could probably do this for other types like i24 and rely on
alignment and padding to allow the backend to use a single wider
load. This isn't my main concern right now and it will need more
tests.
We could also allow larger types up to some limit and let the
backend split into multiple loads, but we need to define that
limit. It's also not my main concern right now.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D107233
More information about the All-commits
mailing list