Thread overview
Profile Guide Optimization on LDC2 -emit-llvm
Mar 27, 2017
Prasun Anand
Mar 27, 2017
David Nadlinger
Mar 27, 2017
Prasun Anand
Mar 27, 2017
Nicholas Wilson
Apr 03, 2017
David Nadlinger
Apr 05, 2017
Prasun Anand
March 27, 2017
Hi,

Recently, I wrote a software in D. I am using ldc2 1.1.0 (DMD v2.071.2, LLVM 3.7.1) for compiling. I am interested in PGO and profiled the project with [ldc-profdata](https://wiki.dlang.org/LDC_LLVM_profiling_instrumentation).

However, I wanted to get a full-report of profiling-data. I find that ldc-profdata
provides only two options i.e. show(not very helpful) and merge.

clang is able to generate .bc files that creates report by adding an
option -emit-llvm.

How can I get a full-report of profiling data?

Regards,
Prasun
March 27, 2017
Hi,

On 27 Mar 2017, at 8:28, Prasun Anand via digitalmars-d-ldc wrote:
> clang is able to generate .bc files that creates report by adding an
> option -emit-llvm.

-emit-llvm causes Clang to emit bitcode instead of object files, and LLVM IR instead of textual assembly. The LDC equivalents are -output-ll and -output-bc, respectively.

I don't think I have used the report you mention myself, so I'm unsure how it relates to that – could you give an example or a link to the corresponding Clang documentation?

 — David
March 27, 2017
On Monday, 27 March 2017 at 12:33:04 UTC, David Nadlinger wrote:
> Hi,
>
> On 27 Mar 2017, at 8:28, Prasun Anand via digitalmars-d-ldc wrote:
>> clang is able to generate .bc files that creates report by adding an
>> option -emit-llvm.
>
> -emit-llvm causes Clang to emit bitcode instead of object files, and LLVM IR instead of textual assembly. The LDC equivalents are -output-ll and -output-bc, respectively.
>
> I don't think I have used the report you mention myself, so I'm unsure how it relates to that – could you give an example or a link to the corresponding Clang documentation?
>
>  — David

Thanks David,

I was looking for how to output bc files and LLVM IR.

Sorry, I am new to LLVM naming conventions. So, I was referring to bitcode and LLVM IR as reports.

Regards,
Prasun
March 27, 2017
On Monday, 27 March 2017 at 17:50:28 UTC, Prasun Anand wrote:
> On Monday, 27 March 2017 at 12:33:04 UTC, David Nadlinger wrote:
>> Hi,
>>
>> On 27 Mar 2017, at 8:28, Prasun Anand via digitalmars-d-ldc wrote:
>>> [...]
>>
>> -emit-llvm causes Clang to emit bitcode instead of object files, and LLVM IR instead of textual assembly. The LDC equivalents are -output-ll and -output-bc, respectively.
>>
>> I don't think I have used the report you mention myself, so I'm unsure how it relates to that – could you give an example or a link to the corresponding Clang documentation?
>>
>>  — David
>
> Thanks David,
>
> I was looking for how to output bc files and LLVM IR.
>
> Sorry, I am new to LLVM naming conventions. So, I was referring to bitcode and LLVM IR as reports.
>
> Regards,
> Prasun

`-output-bc` and `-output-ll`
April 03, 2017
Hi Prasun,

On 27 Mar 2017, at 19:50, Prasun Anand via digitalmars-d-ldc wrote:
> Sorry, I am new to LLVM naming conventions. So, I was referring to bitcode and LLVM IR as reports.

No worries, I was just not sure what you were referring to. Actually, to be fully correct, bitcode is LLVM IR as well, and I should really be speaking about its textual vs. binary forms.

 — David
April 05, 2017
On Monday, 3 April 2017 at 21:52:46 UTC, David Nadlinger wrote:
> Hi Prasun,
>
> On 27 Mar 2017, at 19:50, Prasun Anand via digitalmars-d-ldc wrote:
>> Sorry, I am new to LLVM naming conventions. So, I was referring to bitcode and LLVM IR as reports.
>
> No worries, I was just not sure what you were referring to. Actually, to be fully correct, bitcode is LLVM IR as well, and I should really be speaking about its textual vs. binary forms.
>
>  — David

Thanks Nicholas and David.

I have been using gperftools and LLVM IR to understand how PGO
works and for optimizing my project :) .

Regards,
Prasun