Add methods for loop unrolling to the OpenMPIRBuilder class and use them in Clang if -fopenmp-enable-irbuilder is enabled. The unrolling methods are:
- unrollLoopFull
- unrollLoopPartial
- unrollLoopHeuristic
unrollLoopPartial and unrollLoopHeuristic can use compiler heuristics to automatically determine the unroll factor. If possible, that is if no CanonicalLoopInfo is required to pass to another method, metadata for LLVM's LoopUnrollPass is added. Otherwise the unroll factor is determined using the same heurstics as user by LoopUnrollPass. Not requiring a CanonicalLoopInfo, especially with unrollLoopHeuristic allows greater flexibility.
With full unrolling and partial unrolling with known unroll factor, instead of duplicating instructions by the OpenMPIRBuilder, the full unroll is still delegated to the LoopUnrollPass. In case of partial unrolling the loop is first tiled using the existing tileLoops methods, then the inner loop fully unrolled using the same mechanism.
make it an unreachable or sink the assert and combine the conditions. Later allows to remove all braces.