This patch registers OpenMPOpt as a Module pass in addition to a CGSCC
pass. This is so certain optimzations that are sensitive to intact
call-sites can happen before inlining. The old openmpopt pass name is
changed to openmp-opt-cgscc and openmp-opt calls the Module pass
which has limited functionality currently.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
Changed the pass registration to happen before the Attributor pass to avoid function specialization. Added a PhaseOrdering test that won't pass without the module pass.
Can you precommit the llvm/test/Transforms/PhaseOrdering/openmp-opt-module.ll test so we can see what changed.
Generally looks good to me otherwise.
llvm/test/Transforms/OpenMP/values_in_offload_arrays.ll | ||
---|---|---|
1–2 | make two run lines, here and elsewhere if applicable |
Changing the OpenMPOpt module pass to only run selected optimizations. Removed the module pass version from most of the tests, more tests will be added once there are additional uses for the module pass.
The following two tests are causing assertion failures when run with the legacy pass manager (force using -enable-new-pm=0).
- Transforms/OpenMP/hide_mem_transfer_latency.ll
- Transforms/OpenMP/values_in_offload_arrays.ll
Waiting on the bugzilla account request to make a ticket but here is the trace.
opt: llvm/lib/Analysis/CallGraphSCCPass.cpp:281: bool (anonymous namespace)::CGPassManager::RefreshCallGraph(const llvm::CallGraphSCC &, llvm::CallGraph &, bool): Assertion `!CheckingMode && "CallGraphSCCPass did not update the CallGraph correctly!"' failed. PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. Stack dump: 0. Program arguments: opt -S -openmp-opt-cgscc -aa-pipeline=basic-aa -openmp-hide-memory-transfer-latency -enable-new-pm=0 1. Running pass 'CallGraph Pass Manager' on module '<stdin>'. #0 0x00000000020bdf43 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (opt+0x20bdf43) #1 0x00000000020bbc00 llvm::sys::RunSignalHandlers() (opt+0x20bbc00) #2 0x00000000020be3f6 SignalHandler(int) llvm/lib/Support/Signals.cpp:0:0 #3 0x00007f15159bf330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330) #4 0x00007f15143a3c37 raise /build/eglibc-ripdx6/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0 #5 0x00007f15143a7028 abort /build/eglibc-ripdx6/eglibc-2.19/stdlib/abort.c:91:0 #6 0x00007f151439cbf6 __assert_fail_base /build/eglibc-ripdx6/eglibc-2.19/assert/assert.c:92:0 #7 0x00007f151439cca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2) #8 0x000000000100ab4f (anonymous namespace)::CGPassManager::RefreshCallGraph(llvm::CallGraphSCC const&, llvm::CallGraph&, bool) llvm/lib/Analysis/CallGraphSCCPass.cpp:0:0 #9 0x00000000010093ac (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) llvm/lib/Analysis/CallGraphSCCPass.cpp:0:0 #10 0x00000000018c6788 llvm::legacy::PassManagerImpl::run(llvm::Module&) (opt+0x18c6788) #11 0x00000000007d06e5 main (opt+0x7d06e5) #12 0x00007f151438ef45 __libc_start_main /build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:321:0 #13 0x00000000007ba679 _start (opt+0x7ba679) [1] 27229 abort opt -S -openmp-opt-cgscc -aa-pipeline=basic-aa -enable-new-pm=0
I'm not sure what the cause of this is, I committed rGb19136e35256c5b21aff93ea5b55b4c142408c40 as a quick work-around. I don't think this patch is the cause, I checked the revision prior to this one landing and it had the same issue. I'm not sure how much of an issue it is overall considering that the new pass manager is the default and hiding the memory transfer latency is an optional feature.
clang-format: please reformat the code