On Wed, 14 Sep 2005, Robert L. Bocchino Jr. wrote:> There's some optimization that turns expressions like this:
>
> short a = ...
> short b > int a' = cast short a to int
> int b' = cast short b to int
> int c = a' + b'
>
> into this:
>
> short a = ...
> short b = ...
> uint a' = cast short a to uint
> uint b' = cast short b to uint
> uint c = a' + b'
> int c = cast uint c to int
>
> Does anyone know which optimization is doing this? I'd like to be able
to
> turn it off.
Hard to say without more information. This is a semantically valid xform,
so it's not "wrong" that it's doing it. To find out what is
doing it,
pass -debug-pass=Arguments to gccas or gccld (whichever is doing it).
This will give you a list of passes you can give to opt to get the same
effect.
You can use this list of passes to do a binary search for the pass that is
doing the xform. If I had to guess, I'd say instcombine, levelraise or
indvars.
-Chris
--
http://nondot.org/sabre/
http://llvm.org/