[LoopUnroll] Add multi-exit test which does not exit through latch.
authorFlorian Hahn <flo@fhahn.com>
Mon, 17 May 2021 15:31:12 +0000 (16:31 +0100)
committerFlorian Hahn <flo@fhahn.com>
Mon, 17 May 2021 16:08:15 +0000 (17:08 +0100)
commitfded6f77c357447b06b952f56c83d2a5487c5adf
tree01dbf50e05b3479ceb96edc2ad61f4d811c78474
parentf4c0fdc6c9db616e2a50e3b39c615f972b4b3158
[LoopUnroll] Add multi-exit test which does not exit through latch.

This patch adds a new test for loop-unrolling with multiple exiting
blocks, where the latch does not exit, but the header does. This can
happen when the loop has not been rotated, e.g. due to minsize.

Inspired by the following end-to-end test, using -Oz
https://godbolt.org/z/fP6sna8qK

    bool foo(int *ptr, int limit) {
        #pragma clang loop unroll(full)
        for (unsigned int i = 0; i < 4; i++) {
            if (ptr[i] > limit)
            return false;
            ptr[i]++;
        }
        return true;
    }
llvm/test/Transforms/LoopUnroll/unroll-header-exiting-with-phis-multiple-exiting-blocks.ll [new file with mode: 0644]