Fix a integer overflow in SimplifyCFG's look up table formation logic.
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 27 Sep 2012 18:29:58 +0000 (18:29 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 27 Sep 2012 18:29:58 +0000 (18:29 +0000)
commit465251a7ce52161adbcb6e80cb84f135dd440de9
treeb233658fd9261a438afb9f88adb2b8c06b61af79
parent593c0b08e651a34266825e41659004e7f932ffb9
Fix a integer overflow in SimplifyCFG's look up table formation logic.

If the width is very large it gets truncated from uint64_t to uint32_t when
passed to TD->fitsInLegalInteger. The truncated value can fit in a register.
This manifested in massive memory usage or crashes (PR13946).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164784 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/switch_to_lookup_table.ll