[Openmp-dev] Using opt tool

Johannes Doerfert via Openmp-dev openmp-dev at lists.llvm.org
Wed Nov 25 15:17:32 PST 2020


On 11/25/20 2:02 PM, Abid Malik via Openmp-dev wrote:
> Thanks, Stefan, Yes I am trying to make changes in OpenOpt.
>
> I will look into it. Clang and opt use the same pipeline. So why it works
> for clang and not for opt.

When you generated your test.ll you did run O3. Then you run opt
with O3 on the result. So, the same pipeline but different inputs.
Also, it is not trivial to get the exact same pipeline between clang
and opt. What you might want to do is:

clang -emit-llvm -S -c -O3 -mllvm -disable-llvm-optzns test.c

which should give you a test.ll that is very close to the one at the
beginning of clangs O3 pipeline. Note that the above command actually
doesn't run O3 passes but just pretends to ensure the frontend generates
the same IR.

To debug your error, maybe start with a debug build of LLVM.

~ Johannes


>
>
>
> On Wed, Nov 25, 2020 at 10:47 AM Stefan Stipanovic <stefomeister at gmail.com>
> wrote:
>
>> Hi Abid,
>>
>> I'm not sure you can get much help without more details. Is it the
>> released version or are you trying to make changes to OpenMPOpt?
>>
>> -debug option can be helpful.
>>
>> --stefan
>>
>> On Wed, Nov 25, 2020 at 3:45 PM Abid Malik via Openmp-dev <
>> openmp-dev at lists.llvm.org> wrote:
>>
>>> Hello,
>>>
>>> I am compiling an OpenMP program using clang
>>>
>>> clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
>>> -O3 -fopenmp -emit-llvm -S -c  test1.c -o test1.ll
>>>
>>> However when I try to compiler test1.ll using opt
>>> $ opt -S -O3 test1.ll
>>>
>>> Stack dump:
>>> 0. Program arguments: opt -S -O3 test1.ll
>>> 1. Running pass 'CallGraph Pass Manager' on module 'test1.ll'.
>>> 0  opt                      0x00000001010ce9b5
>>> llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
>>> 1  opt                      0x00000001010cd878
>>> llvm::sys::RunSignalHandlers() + 248
>>> 2  opt                      0x00000001010cefcc SignalHandler(int) + 268
>>> 3  libsystem_platform.dylib 0x00007fff71f715fd _sigtramp + 29
>>> 4  libsystem_platform.dylib 000000000000000000 _sigtramp +
>>> 18446603338604145184
>>> 5  opt                      0x0000000100b87a32 (anonymous
>>> namespace)::OpenMPOpt::run() + 4162
>>> 6  opt                      0x0000000100b9134b (anonymous
>>> namespace)::OpenMPOptLegacyPass::runOnSCC(llvm::CallGraphSCC&) + 651
>>> 7  opt                      0x00000001003e63c4 (anonymous
>>> namespace)::CGPassManager::runOnModule(llvm::Module&) + 1172
>>> 8  opt                      0x0000000100a35db9
>>> llvm::legacy::PassManagerImpl::run(llvm::Module&) + 825
>>> 9  opt                      0x00000001000aed32 main + 13138
>>> 10 libdyld.dylib            0x00007fff71d78cc9 start + 1
>>> 11 libdyld.dylib            0x0000000000000004 start +
>>> 18446603338606211900
>>> Segmentation fault: 11
>>>
>>> Thanks,
>>>
>>>
>>> --
>>> Abid M. Malik
>>> ******************************************************
>>> "I have learned silence from the talkative, toleration from the
>>> intolerant, and kindness from the unkind"---Gibran
>>> "Success is not for the chosen few, but for the few who choose" --- John
>>> Maxwell
>>> "Being a good person does not depend on your religion or status in life,
>>> your race or skin color, political views or culture. IT DEPENDS ON HOW GOOD
>>> YOU TREAT OTHERS"--- Abid
>>> "The Universe is talking to us, and the language of the Universe is
>>> mathematics."----Abid
>>>
>>> _______________________________________________
>>> Openmp-dev mailing list
>>> Openmp-dev at lists.llvm.org
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
>>>
>
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev


More information about the Openmp-dev mailing list