Switch containing holes via table lookup
Hans Wennborg
hans at chromium.org
Mon Feb 24 10:28:25 PST 2014
+llvm-commits, trying to get the thread back on the list.
On Mon, Feb 24, 2014 at 10:28 AM, Hans Wennborg <hans at hanshq.net> wrote:
> On Sun, February 23, 2014 16:29, Jasper Neumann wrote:
>> Hello Hans!
>>
>> > Hmm, I replied on the 18th: >
>> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140217/205303.html,
>>
>> > with jn at sirrida.de in the To: field and the list as CC.
>>
>> I'm very sorry I missed this.
>> It might be that your email never reached me because I had problems with
>> receiving emails from the LLVM mailing lists; I got 5 emails containing
>> text like this:
>>
>> "Your membership in the mailing list llvm-commits has been disabled due
>> to excessive bounces The last bounce received from you was dated
>> 22-Feb-2014. You will not get any more messages from this list until
>> you re-enable your membership. You will receive 3 more reminders like
>> this before your membership in the list is deleted."
>>
>> It might help to read the forum posts online instead of only waiting for
>> emails...
>>
>>
>> > Anyway, at the bottom of my reply I pointed out that I think our
>> > problem is that your patch adds a new branch to the "default" BB.
>> > If that BB had a phi node in it, it will now have a new incoming
>> > edge without a value, and that would cause the assertion you're
>> > hitting.
>>
>> This is about what I thought.
>> But what are the magic words I should cast to cure this?
>> It tried stuff like
>> AddPredecessorToBlock(SI->getDefaultDest(), MaskBB, LookupBB);
>> but until now had no success.
>
> If I put this:
>
> AddPredecessorToBlock(SI->getDefaultDest(), MaskBB, SI->getParent());
>
> right after your line that creates the conditional branch at the end of
> BranchBB, everything seems to work.
>
> I also made up a test case that's easier to work with. This seems to fail
> with the same assert you were seeing:
>
> int f(int x) {
> int z;
> int y;
>
> if (x % 123 == 0) {
> y = 1;
> goto label;
> }
> y = 2;
>
> switch (x) {
> case 0:
> z = 1;
> break;
> case 1:
> z = 2;
> break;
> case 2:
> z = 3;
> break;
> case 7:
> z = 4;
> break;
>
> default:
> label:
> z = y;
> }
>
> return z;
> }
>
> int h(int x) {
> return f(x);
> }
>
> Thanks,
> Hans
More information about the llvm-commits
mailing list