Promotion of integral values

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Promotion of integral values

Robert L. Bocchino Jr.
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.

Rob

Robert L. Bocchino Jr.
Ph.D. Student, Computer Science
University of Illinois, Urbana-Champaign
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Promotion of integral values

Chris Lattner
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/

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Staged LLVM emulator

Patrick Meredith


Were there ever any plans to make a staged emulator that only JIT's hot
functions (interpreting the lesser used ones)?  Emulators such as this tend
to perform better when there are a lot of infrequently used functions.


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Staged LLVM emulator

Chris Lattner
On Thu, 15 Sep 2005, Patrick Meredith wrote:
> Were there ever any plans to make a staged emulator that only JIT's hot
> functions (interpreting the lesser used ones)?  Emulators such as this tend
> to perform better when there are a lot of infrequently used functions.

I'm not aware of any work to implement this sort of thing, but it
shouldn't be too hard.  We're currently lacking a decent interpreter, so
that would be the first place to start.

-Chris

--
http://nondot.org/sabre/
http://llvm.org/

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

RE: Staged LLVM emulator

Patrick Meredith


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of Chris Lattner
Sent: Thursday, September 15, 2005 1:18 PM
To: LLVM Developers Mailing List
Subject: Re: [LLVMdev] Staged LLVM emulator

On Thu, 15 Sep 2005, Patrick Meredith wrote:
> Were there ever any plans to make a staged emulator that only JIT's hot
> functions (interpreting the lesser used ones)?  Emulators such as this
tend
> to perform better when there are a lot of infrequently used functions.

I'm not aware of any work to implement this sort of thing, but it
shouldn't be too hard.  We're currently lacking a decent interpreter, so
that would be the first place to start.

-Chris

--
http://nondot.org/sabre/
http://llvm.org/

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

I might be able to work on that in spare time, we'll see.  Do you think it's
a worthwhile thing to work on?



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

RE: Staged LLVM emulator

Chris Lattner

On Thu, 15 Sep 2005, Patrick Meredith wrote:
> I might be able to work on that in spare time, we'll see.  Do you think
> it's a worthwhile thing to work on?

If you're interested in working on this, you should probably talk to Chris
Morgan, who was recently asking about the interpreter:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2005-September/004799.html

-Chris


>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On
> Behalf Of Chris Lattner
> Sent: Thursday, September 15, 2005 1:18 PM
> To: LLVM Developers Mailing List
> Subject: Re: [LLVMdev] Staged LLVM emulator
>
> On Thu, 15 Sep 2005, Patrick Meredith wrote:
>> Were there ever any plans to make a staged emulator that only JIT's hot
>> functions (interpreting the lesser used ones)?  Emulators such as this
> tend
>> to perform better when there are a lot of infrequently used functions.
>
> I'm not aware of any work to implement this sort of thing, but it
> shouldn't be too hard.  We're currently lacking a decent interpreter, so
> that would be the first place to start.
>
> -Chris
>
>

-Chris

--
http://nondot.org/sabre/
http://llvm.org/

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev