Fix full unrolling with new pass manager.
authorEric Christopher <echristo@gmail.com>
Mon, 4 May 2020 20:48:56 +0000 (13:48 -0700)
committerEric Christopher <echristo@gmail.com>
Sat, 30 May 2020 03:08:21 +0000 (20:08 -0700)
commitc554c5e159aee43c5cd8236e077817e9f29dea78
tree392772bc9f5284440820b2acd78cf2372d627c18
parent034a7b6604067b0ccb36c761a5782456b76c447e
Fix full unrolling with new pass manager.

Last we looked at this and couldn't come up with a reason to change
it, but with a pragma for full loop unrolling we bypass every other
loop unroll and then fail to fully unroll a loop when the pragma is set.

Move the OnlyWhenForced out of the check and into the initialization
of the full unroll pass in the new pass manager. This doesn't show up
with the old pass manager.

Add a new option to opt so that we can turn off loop unrolling
manually since this is a difference between clang and opt.

Tested with check-clang and check-llvm.
clang/test/Misc/loop-opt-setup.c
llvm/lib/Passes/PassBuilder.cpp
llvm/test/Transforms/LoopUnroll/FullUnroll.ll [new file with mode: 0644]
llvm/tools/opt/NewPMDriver.cpp