Alan Garny
2013-Jun-20 13:07 UTC
[LLVMdev] LLVM+Clang 3.3: clang: for the -vectorize-loops option: may only occur zero or one times!
Hi, My application generates some C code which I then compile using LLVM+Clang before running it. For the compilation side of things, I have a class which one of the methods (the CompilerEngine::compileCode() method in https://raw.github.com/opencor/opencor/llvm_3.3/src/plugins/misc/Compiler/sr c/compilerengine.cpp) is based on the code from the clang-interpreter example (http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/clang-interpreter/ma in.cpp?view=co). The idea is therefore to create an instance of the 'compiler' class and, among other things, use its compileCode() whenever needed. All of this works perfectly fine using LLVM+Clang 3.2, but not with LLVM+Clang 3.3. At least, not out of the box. Basically, the first time I try to compile some C code, everything is fine. However, if I try to compile some other C code, then I will get the following error message: clang: for the -vectorize-loops option: may only occur zero or one times! FWIW, I use the -O3 option which I understand makes implicit use of the loop vectorizer, and that seems to be the problem. Indeed, if I disable the loop vectorizer (using the -fno-vectorize option), then everything is fine but I clearly don't want to have to do that. So, right now, my solution consists of commenting out the test for the number of option occurrences in the Option::addOccurrence() method (http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp? view=co), but it is clearly not satisfactory either (even though it's good enough for my particular purpose). So, would anyone have any idea about what I might be missing, if anything?... Cheers, Alan. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130620/4ab9324e/attachment.html>
Mario Schwalbe
2013-Jun-21 08:32 UTC
[LLVMdev] LLVM+Clang 3.3: clang: for the -vectorize-loops option: may only occur zero or one times!
Hi, I can confirm this problem. We use clang's libtooling ToolInvocation object and the second module fails to compile even through it's a completely fresh instance. Adding -fno-vectorize explicitly seems to work around this problem, but does anyone know a real fix? ciao, Mario Am 20.06.13 15:07, schrieb Alan Garny:> My application generates some C code which I then compile using LLVM+Clang before running it. For the compilation side of things, I have a class which one of the methods (the CompilerEngine::compileCode() method in https://raw.github.com/opencor/opencor/llvm_3.3/src/plugins/misc/Compiler/sr c/compilerengine.cpp) is based on the code from the clang-interpreter example (http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/clang-interpreter/ma in.cpp?view=co). The idea is therefore to create an instance of the 'compiler' class and, among other things, use its compileCode() whenever needed. > > All of this works perfectly fine using LLVM+Clang 3.2, but not with LLVM+Clang 3.3. At least, not out of the box. Basically, the first time I try to compile some C code, everything is fine. However, if I try to compile some other C code, then I will get the following error message: > > clang: for the -vectorize-loops option: may only occur zero or one times! > > FWIW, I use the -O3 option which I understand makes implicit use of the loop vectorizer, and that seems to be the problem. Indeed, if I disable the loop vectorizer (using the -fno-vectorize option), then everything is fine but I clearly don't want to have to do that. So, right now, my solution consists of commenting out the test for the number of option occurrences in the Option::addOccurrence() method (http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp? view=co), but it is clearly not satisfactory either (even though it's good enough for my particular purpose). > > So, would anyone have any idea about what I might be missing, if anything?... > > Cheers, Alan.
Alan Garny
2013-Jun-21 16:40 UTC
[LLVMdev] LLVM+Clang 3.3: clang: for the -vectorize-loops option: may only occur zero or one times!
Thanks Mario, it's good (so to speak!) to know that I am not the only one experiencing this problem! I have had another look at the LLVM code and, as far as I can tell, it would seem that it's related to llvm::cl:: RegisteredOptionList not being properly reset or something. Anyway, I want to be able to take advantage of the loop vectorizer, so I have decided to comment out the test for the number of option occurrences in the Option::addOccurrence() method (http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp? view=co). Not nice, but it seems to be doing the job for me and, unless I am told/shown otherwise, there doesn't seem to be any other solution, so... Alan> -----Original Message----- > From: Mario Schwalbe [mailto:m3o.s6e at googlemail.com] > Sent: 21 June 2013 10:32 > To: Alan Garny > Cc: LLVM Dev; Clang Dev; Mario Schwalbe > Subject: Re: [LLVMdev] LLVM+Clang 3.3: clang: for the -vectorize-loopsoption:> may only occur zero or one times! > > Hi, > > I can confirm this problem. We use clang's libtooling ToolInvocationobject> and the second module fails to compile even through it's a completelyfresh> instance. > > Adding -fno-vectorize explicitly seems to work around this problem, butdoes> anyone know a real fix? > > ciao, > Mario > > Am 20.06.13 15:07, schrieb Alan Garny: > > My application generates some C code which I then compile using > LLVM+Clang before running it. For the compilation side of things, I have a > class which one of the methods (the CompilerEngine::compileCode() method > in > https://raw.github.com/opencor/opencor/llvm_3.3/src/plugins/misc/Compiler > /sr c/compilerengine.cpp) is based on the code from the clang-interpreter > example (http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/clang- > interpreter/ma in.cpp?view=co). The idea is therefore to create aninstance of> the 'compiler' class and, among other things, use its compileCode()whenever> needed. > > > > All of this works perfectly fine using LLVM+Clang 3.2, but not with > LLVM+Clang 3.3. At least, not out of the box. Basically, the first time Itry to> compile some C code, everything is fine. However, if I try to compile some > other C code, then I will get the following error message: > > > > clang: for the -vectorize-loops option: may only occur zero or onetimes!> > > > FWIW, I use the -O3 option which I understand makes implicit use of the > loop vectorizer, and that seems to be the problem. Indeed, if I disablethe> loop vectorizer (using the -fno-vectorize option), then everything is finebut I> clearly don't want to have to do that. So, right now, my solution consistsof> commenting out the test for the number of option occurrences in the > Option::addOccurrence() method (http://llvm.org/viewvc/llvm- > project/llvm/trunk/lib/Support/CommandLine.cpp? view=co), but it isclearly> not satisfactory either (even though it's good enough for my particular > purpose). > > > > So, would anyone have any idea about what I might be missing, if > anything?... > > > > Cheers, Alan.
Apparently Analagous Threads
- [LLVMdev] LLVM+Clang 3.3: clang: for the -vectorize-loops option: may only occur zero or one times!
- [LLVMdev] LLVM 3.6: problems building on Windows using MSVC 2013
- [LLVMdev] LLVM 2.9 - JIT problem on Windows
- [LLVMdev] LLVM 3.6: problems building on Windows using MSVC 2013
- Put ToolInvoker Output Into a String