Improve if-then-else tree for cases on literal values
authorJoachim Breitner <mail@joachim-breitner.de>
Mon, 2 Mar 2015 20:20:24 +0000 (21:20 +0100)
committerJoachim Breitner <mail@joachim-breitner.de>
Mon, 2 Mar 2015 22:12:46 +0000 (23:12 +0100)
commitc3eee14d31585445d4a7eff5b6c69a815b911059
tree052db8973e5fe2c1e4ce823f6f2b267b86dd8d8c
parent3197018d4efbf7407577300b88897cef26f7f4c6
Improve if-then-else tree for cases on literal values

Previously, in the branch of the if-then-else tree, it would emit a
final check if the scrut matches the alternative, even if earlier
comparisons alread imply this equality. By keeping track of the bounds
we can skip this check. Of course this is only sound for integer types.
This closes #10129.
Differential Revision: https://phabricator.haskell.org/D693
compiler/basicTypes/Literal.hs
compiler/codeGen/StgCmmUtils.hs