[llvm-commits] [llvm-gcc] Cast Fix

Chris Lattner clattner at apple.com
Thu Dec 21 14:15:04 PST 2006


> You asked for a case where I need to (recursively) determine the  
> sign of
> a some Value. I have a case in mind:
> lib/Transforms/Utils/LowerSwitch.cpp.  When it decides to lower  
> this to
> a branch tree it is recursively calling switchConvert and passing the
> switch value in. The signedness is needed in order to generate the
> ICmpInst with either SLT or ULT for the branch tree. But that Value*
> being tested originates from operand 0 of the switch instruction.
> There's no way to determine if its signed or unsigned without starting
> to look at it. As I noted in my example below, it could take several
> steps of tracking through instructions before I come up with a
> definitive answer. And there may be no way to determine it  
> statically if
> that search ends up at an argument, global variable, or constant.
>
> Can we just make switch staetments always use SLT for the  
> comparison and
> have the issue go away?

Switch lowering can use either slt or ult, as long as it is  
consistent.  Please use ULT.

-Chris



More information about the llvm-commits mailing list