Re: [llvm-commits] llvm-gcc: emit switch cases with a wide range as a conditional branch

2007-03-16 Thread Duncan Sands
I am testing the following patch. While I was there, I made it agnostic as to the signedness of the switch expression and cases (in Ada they can be unsigned). I forgot to emit a new BB after the unconditional branch to the default label. Attached patch is otherwise the same as the previous

Re: [llvm-commits] llvm-gcc: emit switch cases with a wide range as a conditional branch

2007-03-14 Thread Duncan Sands
Hi Chris, thanks for looking at the patch. In gcc, a switch case is a range of values that branch to a label, for example 1 .. 17 - label. These are emitted as individual LLVM switch cases: 1 - label, 2 - label, ..., 17 - label. This works well except, for example, when the range is

Re: [llvm-commits] llvm-gcc: emit switch cases with a wide range as a conditional branch

2007-03-14 Thread Reid Spencer
On Wed, 2007-03-14 at 17:40 +0100, Duncan Sands wrote: Hi Chris, thanks for looking at the patch. In gcc, a switch case is a range of values that branch to a label, for example 1 .. 17 - label. These are emitted as individual LLVM switch cases: 1 - label, 2 - label, ..., 17 -

Re: [llvm-commits] llvm-gcc: emit switch cases with a wide range as a conditional branch

2007-03-14 Thread Duncan Sands
Hi Reid, thanks for replying. Please use APInt's to do the subtraction, instead of constant folding. Reid should be able to help you with this. I don't understand why. If APInt's are much more efficient, then shouldn't ConstantExpr:getSub be improved to detect this case and

Re: [llvm-commits] llvm-gcc: emit switch cases with a wide range as a conditional branch

2007-03-14 Thread Duncan Sands
I am testing the following patch. While I was there, I made it agnostic as to the signedness of the switch expression and cases (in Ada they can be unsigned). Bootstraps (C, C++, Ada) and passes make check. Duncan. ___ llvm-commits mailing list

Re: [llvm-commits] llvm-gcc: emit switch cases with a wide range as a conditional branch

2007-03-13 Thread Chris Lattner
On Mar 12, 2007, at 1:48 PM, Duncan Sands wrote: In gcc, a switch case is a range of values that branch to a label, for example 1 .. 17 - label. These are emitted as individual LLVM switch cases: 1 - label, 2 - label, ..., 17 - label. This works well except, for example, when the range is

[llvm-commits] llvm-gcc: emit switch cases with a wide range as a conditional branch

2007-03-12 Thread Duncan Sands
In gcc, a switch case is a range of values that branch to a label, for example 1 .. 17 - label. These are emitted as individual LLVM switch cases: 1 - label, 2 - label, ..., 17 - label. This works well except, for example, when the range is INT_MIN .. 0 - label, in which case you can say goodbye