]> git.lizzy.rs Git - rust.git/commit
Use type-alignment-sized integer for discriminant types
authorJames Miller <james@aatch.net>
Sat, 20 Dec 2014 05:53:37 +0000 (18:53 +1300)
committerJames Miller <james@aatch.net>
Mon, 22 Dec 2014 23:29:52 +0000 (12:29 +1300)
commitf1a3ff047e386d19238a880b42eb4edacbee0c1b
treef6a85e57fa6e9174314eb195a53d5cb135b84b0f
parent2f3cff6956d56048ef7afb6d33e17cbdb2dcf038
Use type-alignment-sized integer for discriminant types

The previous behaviour of using the smallest type possible caused LLVM
to treat padding too conservatively, causing poor codegen. This commit
changes the behaviour to use an type-alignment-sized integer as the
discriminant. This keeps types the same size, but helps LLVM understand
the data structure a little better, resulting in better codegen.
src/librustc_trans/trans/adt.rs
src/test/run-pass/type-sizes.rs