[Clang] Ensure vector predication loop metadata is always emitted when pragma is...
authorMalhar <malhar.jajoo@arm.com>
Sat, 13 Feb 2021 21:57:21 +0000 (15:57 -0600)
committerMichael Kruse <llvm-project@meinersbur.de>
Sat, 13 Feb 2021 23:35:54 +0000 (17:35 -0600)
commit74ddacd30de54e19b28218bc8563bd0f34f32cad
tree8ebbefc3741c61d43f6e4a6e50dda7818851b4d5
parent53187f1eeccb22ab6ef3f5ba5acfbe0ebeed1dbd
[Clang] Ensure vector predication loop metadata is always emitted when pragma is specified.

This patch ensures that vector predication and vectorization width
pragmas work together correctly/as expected. Specifically, this patch
fixes the issue that when vectorization_width > 1, the vector
predication behaviour (this would matter if it has NOT been disabled
explicitly by a pragma) was getting ignored, which was incorrect.

The fix here removes the dependence of vector predication on the
vectorization width. The loop metadata corresponding to clang loop
pragma vectorize_predicate is always emitted, if the pragma is
specified, even if vectorization is disabled by vectorize_width(1)
or vectorize(disable) since the option is also used for interleaving
by the LoopVectorize pass.

Reviewed By: dmgreen, Meinersbur

Differential Revision: https://reviews.llvm.org/D94779
clang/lib/CodeGen/CGLoopInfo.cpp
clang/test/CodeGenCXX/pragma-loop-predicate.cpp