Hello, Elliot

Yes,turning that off works !

Thank you very much !

On Tue, Dec 16, 2014 at 7:15 PM, Elliot Ronaghan <[email protected]> wrote:
>
> Hi Hui,
>
> If you compile your program with --baseline (or just
> --no-copy-propagation) you should see that most local variables names are
> still in the llvm IR. I'm testing with the C backend, but it should be
> true for you too. The reason that they are normally missing is because of
> normalization and optimizations like copy propagation. Your globals will
> probably maintain their names because copy propagation isn't performed on
> global variables.
>
> As an example things like:
>
>   var x = 1 + 1 + 1;
>   writeln(x);
>
> with normalization will turn into:
>
>   tmp1 = 1+1;
>   tmp2 = tmp1+1;
>   x = tmp2;
>   writeln(x);
>
> and copy propagation will turn that into:
>
>   tmp1 = 1+1;
>   tmp2 = tmp1+1;
>   writeln(tmp2);
>
>
> Note that my example is a simplification and might not represent
> normalization or copy propagation exactly, but that's the basic idea. In
> some cases your local variable names will still be preserved, it really
> depends on the code.
>
>
> So far as I know, that's the reason your local variable names are missing.
> Turning off copy propagation is going to add a lot more bloat to the IR so
> I don't know how useful it's going to be to you. You'll at least be able
> to find the local variable names, but there's going to be a lot of
> needless assignments.
>
> Elliot
>
>
> -----Original Message-----
> From: Hui Zhang <[email protected]>
> Date: Tuesday, December 16, 2014 at 3:53 PM
> To: Chapel Sourceforge Developers List
> <[email protected]>
> Subject: [Chapel-developers] question about local variable names
>
> >Hello,
> >
> >
> >I'm looking at the llvm output of the chapel programs compiled with
> >"--llvm", I found that all the local variables are named as "*_temp*",
> >mostly call_temp1, call_temp2......therefore
> > I can't find the exactly local variable that I defined in the source
> >code.
> >
> >
> >​Later on, I just tested some other programs in the benchmark, and I
> >found that local variables with the same name as in chapel program are in
> >the LLVM IR ! (of course, there are many
> > other call_tmp as well) So the compiler does generate local variables
> >with the same chapel name, but it doesn't when I test my super simple
> >chapel program, really weird...my code is as below:
> >
> >
> >module Hui {
> >  config const message = "Hello, world!";
> >  var gv_t: (int, real) = (1, 2.3);
> >  var gv_b: bool = true;
> >
> >  // Define an Actor class
> >  class Actor {
> >    var name: string;
> >    var age: uint;
> >  }
> >
> >  var globalActor: Actor;
> >
> > proc sayhello(level: int){
> >    writeln("Hello, Hui",level);
> >  }
> >
> >  proc factorial(x: int) : int {
> >    var anything=(x+5)**x : int;
> >    sayhello(anything);
> >    if x < 0 then
> >         halt("factorial -- Sorry, this is not the gamma procedure!");
> >    return if x == 0 then 1 else x * factorial(x-1);
> >  }
> >
> >  writeln("A simple procedure");
> >
> >  proc main() {
> >    var localActor = new Actor();
> >    var Number=6: int;
> >    writeln(message);
> >    writeln("6! is ", factorial(Number));
> >  }
> >}
> >
> >
> >So When I searched IR, I did find global variables like gv_t, gv_b,
> >globalActor, but I couldn't find "anything" (local in factorial), or
> >"localActor","Number" (local in main)
> >
> >
> >Can anyone tell why is that ?
> >
> >
> >​Thanks​
> >
> >--
> >Best regards
> >
> >
> >Hui Zhang
> >
> >
>
>

-- 
Best regards


Hui Zhang
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to