[llvm-commits] [llvm] r164934 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/switch_to_lookup_table.ll
Benjamin Kramer
benny.kra at gmail.com
Wed Oct 3 04:01:37 PDT 2012
On 03.10.2012, at 12:41, Hans Wennborg <hans at chromium.org> wrote:
> On Mon, Oct 1, 2012 at 12:31 PM, Benjamin Kramer
> <benny.kra at googlemail.com> wrote:
>> Author: d0k
>> Date: Mon Oct 1 06:31:48 2012
>> New Revision: 164934
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=164934&view=rev
>> Log:
>> SimplifyCFG: Don't crash when forming a switch bitmap with an undef default value.
>>
>> Fixes PR13985.
>
> Thanks for fixing!
>
> Could there be other cases where a Constant with Integer type does not
> turn out to be a ConstantInt?
Looking at ValidLookupTableConstant:
> if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
> return CE->isGEPWithNoNotionalOverIndexing();
>
> return isa<ConstantFP>(C) ||
> isa<ConstantInt>(C) ||
> isa<ConstantPointerNull>(C) ||
> isa<GlobalValue>(C) ||
> isa<UndefValue>(C);
GEP constantexprs, ConstantPointerNull and GlobalValues always have pointer type, leaving only ConstantFP (which is always FP), UndefValue (which can be anything) and ConstantInt. I think handling ConstantInt and UndefValue is sufficient.
- Ben
More information about the llvm-commits
mailing list