[cfe-users] Using clang LTO with POLLY
I'm hacking on a compiler with a fairly complicated build system and trying to experiment with POLLY (https://polly.llvm.org) alongside LLVM LTO. The general shape of the last part of compilation looks like: opt-6.0 -O2 -enable-tbaa -tbaa '-relocation-model=static' application.ll -o application.o clang -flto -c /tmp/baz_3.c -o /tmp/baz_4.o clang -flto -o /tmp/floop -Wl,--gc-sections application.o -L/lots_of_lto_objs_here /tmp/baz_4.o -Wl,-u,foo -Wl,-u,bar -llto_obj1 -lto_obj2 -letc -lnuma In the last step we link a whole bunch of LLVM LTO objects (LLVM IR bitcode, as I understand it). This seems to work fine, but now I'm struggling to add POLLY into the mix. If I add `-O3 -mllvm -polly` to the last clang invocation, I just get clang: warning: argument unused during compilation: '-mllvm -polly' [-Wunused-command-line-argument] Is there a convenient way to use POLLY with LTO? I've seen http://polly.llvm.org/docs/HowToManuallyUseTheIndividualPiecesOfPolly.html but I'm not sure how to adapt that to what I need in a convenient way since I'm doing a lot of shimming of `clang`, `lld`, etc in order to get as far as I have. I think I need to stay on llvm/clang v6, although newer `lld` seemed to work fine. Thanks, Brandon http://brandon.si ___ cfe-users mailing list cfe-users@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
Re: [cfe-users] Fwd: Re: [llvm-dev] Overriding macro values defined in source code
Thanks Richard for the answer. I have another question regarding the include(-I) option. If we have a c file called cfile.c and a header file called header.h both in the same directory say (dir x). cfile.c includes header.h as shown below #include "header.h" And if in some other directory say (dir y)we have another header file with the same name(header.h) but with a different content then when I try to generate the preprocessed file using the below command, clang.exe -E path of cfile.c -I path of dir y The header.h present in the directory dir x is getting considered even though -I points to dir y. Is this the intended behavior that the current directory is searched first for the header files irrespective of the directory provided against the -I option. If not how to make clang consider only the directories provided against the -I option and not the current directory. Thanks in advance On May 9, 2019 5:01 AM, "Richard Smith" wrote: On Mon, 6 May 2019 at 23:09, Sudhindra kulkarni via cfe-users wrote: > > > -- Forwarded message -- > From: "Tim Northover" > Date: May 1, 2019 3:48 PM > Subject: Re: [llvm-dev] Overriding macro values defined in source code > To: "Sudhindra kulkarni" > Cc: "LLVM Developers Mailing List" > > On Tue, 30 Apr 2019 at 22:28, Sudhindra kulkarni via llvm-dev > wrote: > > Is it possible to override the value of AVAL through the -D option? > > For eg is it possible to set the value of AVAL to 2 through -D in clang ? > > This is more a question for the cfe-users list, but as far as I know > there's no way to prevent redefinitions in source files. > > Cheers. > > Tim. > > Hi Team, > Consider the below C code, > #define AVAL 5 > void func() > { > int a=5; > if(a==AVAL) > { > //Do something > } > else > { > //Do something else > } > > } > My question is > Is it possible to override the value of AVAL through the -D option? > For eg is it possible to set the value of AVAL to 2 through -D in clang so that the else part executes? > Also apart from -D option we are also open to other ways of achieving this The normal approach is to change the source to something like #ifndef AVAL #define AVAL 5 #endif > Thanks in advance > ___ > cfe-users mailing list > cfe-users@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users ___ cfe-users mailing list cfe-users@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
Re: [cfe-users] Fwd: Re: [llvm-dev] Overriding macro values defined in source code
Hi Richard, Thanks for the quick response. I tried the -I- option. I ran the below command clang.exe -E path of cfile.c -I path of dir y -I- With this I get the below error clang.exe:error :-I- not supported , please use -iquote instead. I tried using -iquote as well clang.exe -E path of cfile.c -I path of dir y -iquote path of dir y Even this did not work and it is still picking up the header file from the same directory as that of the c file ie dir x. I am using clang 6.0.1 Is the -I- option deprecated in clang 6.0.1? If not is the usage of the flag(-I- and -iquote) not proper. Thanks in advance On May 10, 2019 1:10 PM, "Richard Smith" wrote: On Thu, 9 May 2019 at 22:47, Sudhindra kulkarni wrote: > > Thanks Richard for the answer. > > I have another question regarding the include(-I) option. > > If we have a c file called cfile.c and a header file called header.h both in the same directory say (dir x). cfile.c includes header.h as shown below > #include "header.h" > And if in some other directory say (dir y)we have another header file with the same name(header.h) but with a different content then when I try to generate the preprocessed file using the below command, > clang.exe -E path of cfile.c -I path of dir y > The header.h present in the directory dir x is getting considered even though -I points to dir y. > > Is this the intended behavior that the current directory is searched first for the header files irrespective of the directory provided against the -I option. > If not how to make clang consider only the directories provided against the -I option and not the current directory. I think the only way to suppress the search in the directory of the file containing the #include is with the -I- (dash, capital i, dash) option. (That option also has other effects on the #include path, and it matters where you place it relative to other -I flags.) It'd probably be worth adding a dedicated flag for just the "don't look in the directory containing the file" effect. > Thanks in advance > > > > > > > > On May 9, 2019 5:01 AM, "Richard Smith" wrote: > > On Mon, 6 May 2019 at 23:09, Sudhindra kulkarni via cfe-users > wrote: > > > > > > -- Forwarded message -- > > From: "Tim Northover" > > Date: May 1, 2019 3:48 PM > > Subject: Re: [llvm-dev] Overriding macro values defined in source code > > To: "Sudhindra kulkarni" > > Cc: "LLVM Developers Mailing List" > > > > On Tue, 30 Apr 2019 at 22:28, Sudhindra kulkarni via llvm-dev > > wrote: > > > Is it possible to override the value of AVAL through the -D option? > > > For eg is it possible to set the value of AVAL to 2 through -D in clang ? > > > > This is more a question for the cfe-users list, but as far as I know > > there's no way to prevent redefinitions in source files. > > > > Cheers. > > > > Tim. > > > > Hi Team, > > Consider the below C code, > > #define AVAL 5 > > void func() > > { > > int a=5; > > if(a==AVAL) > > { > > //Do something > > } > > else > > { > > //Do something else > > } > > > > } > > My question is > > Is it possible to override the value of AVAL through the -D option? > > For eg is it possible to set the value of AVAL to 2 through -D in clang so that the else part executes? > > Also apart from -D option we are also open to other ways of achieving this > > The normal approach is to change the source to something like > > #ifndef AVAL > #define AVAL 5 > #endif > > > Thanks in advance > > ___ > > cfe-users mailing list > > cfe-users@lists.llvm.org > > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users > > ___ cfe-users mailing list cfe-users@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users