Diptorup Deb via llvm-dev
2017-Sep-18 05:12 UTC
[llvm-dev] Clang/LLVM 5.0 optnone attribute with -O0
Hi, We have a research LLVM-based domain-specific code generator that we want to upgrade form LLVM 4.0 to 5.0. The code generator is written as an out-of-tree loadable module for opt. Till Clang 4.0 we were compiling the front-end code (annotated C++) using -O0. The generated bitcode was further processed using opt with our module loaded. In Clang 5.0 we see that using -O0 adds the optnone attribute to all functions, making it impossible to use any existing LLVM passes in our code generator. We also tried using - "clang -Xclang -load -Xclang <module>.so -mllvm <custom options>" , but this caused a segfault at llvm::legacy::FunctionPassManagerImpl::doInitialization(llvm::Module&). What is the right way to get around this issue? Dipto
Craig Topper via llvm-dev
2017-Sep-18 05:27 UTC
[llvm-dev] Clang/LLVM 5.0 optnone attribute with -O0
To prevent optnone from being added you can replace -O0 with "-O1 -Xclang -disable-llvm-passes". The -O1 will prevent the optnone, and the rest will stop clang from performing any optimizations. ~Craig On Sun, Sep 17, 2017 at 10:12 PM, Diptorup Deb via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > > We have a research LLVM-based domain-specific code generator that we want > to upgrade form LLVM 4.0 to 5.0. The code generator is written as an > out-of-tree loadable module for opt. > > Till Clang 4.0 we were compiling the front-end code (annotated C++) using > -O0. The generated bitcode was further processed using opt with our module > loaded. In Clang 5.0 we see that using -O0 adds the optnone attribute to > all functions, making it impossible to use any existing LLVM passes in our > code generator. > > We also tried using - > "clang -Xclang -load -Xclang <module>.so -mllvm <custom options>" > > , but this caused a segfault at llvm::legacy::FunctionPassMana > gerImpl::doInitialization(llvm::Module&). > > What is the right way to get around this issue? > > Dipto > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170917/8ce4fee5/attachment.html>
Haidl, Michael via llvm-dev
2017-Sep-18 10:44 UTC
[llvm-dev] Clang/LLVM 5.0 optnone attribute with -O0
You can also add the -Xclang -disable-O0-optnone flag to your command line. This will disable the implicit optnone when compiling with O0. Cheers, Michael On Mon, Sep 18, 2017 at 7:27 AM +0200, "Craig Topper via llvm-dev" <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: To prevent optnone from being added you can replace -O0 with "-O1 -Xclang -disable-llvm-passes". The -O1 will prevent the optnone, and the rest will stop clang from performing any optimizations. ~Craig On Sun, Sep 17, 2017 at 10:12 PM, Diptorup Deb via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: Hi, We have a research LLVM-based domain-specific code generator that we want to upgrade form LLVM 4.0 to 5.0. The code generator is written as an out-of-tree loadable module for opt. Till Clang 4.0 we were compiling the front-end code (annotated C++) using -O0. The generated bitcode was further processed using opt with our module loaded. In Clang 5.0 we see that using -O0 adds the optnone attribute to all functions, making it impossible to use any existing LLVM passes in our code generator. We also tried using - "clang -Xclang -load -Xclang <module>.so -mllvm <custom options>" , but this caused a segfault at llvm::legacy::FunctionPassManagerImpl::doInitialization(llvm::Module&). What is the right way to get around this issue? Dipto _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170918/59058986/attachment.html>
Maybe Matching Threads
- Clang/LLVM 5.0 optnone attribute with -O0
- Difference between clang -O1 -Xclang -disable-O0-optnone and clang -O0 -Xclang -disable-O0-optnone in LLVM 9
- Help with segfault in llvm_shutdown with LLVM 5.0 Release build
- Question regarding LICM
- Relationship between clang, opt and llc