[PATCH] D69628: [Clang] Pragma vectorize_width() implies vectorize(enable), take 3

Michael Kruse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 14:31:14 PST 2019


Meinersbur added a comment.

Sorry for the delay, for some reason I did not see a notification for the update.



================
Comment at: clang/lib/CodeGen/CGLoopInfo.cpp:302-306
+    // Imply vectorize.enable when it is not already disabled/enabled.
+    Args.push_back(
+        MDNode::get(Ctx, {MDString::get(Ctx, "llvm.loop.vectorize.enable"),
+                          ConstantAsMetadata::get(ConstantInt::get(
+                              llvm::Type::getInt1Ty(Ctx), 1))}));
----------------
[serious] Why not reusing the `Args.push_back` code from above? I think it is important `vectorize_predicate` and `vectorize_width` (and ever additional property we introduce in the future) the same way. IMHO everything else becomes more and more confusing.
I have the following in mind:

```
if (Attrs.VectorizeEnable != LoopAttributes::Unspecified ||
      IsVectorPredicateEnabled || Attrs.VectorizeWidth > 1) {
    auto AttrVal = Attrs.VectorizeEnable != LoopAttributes::Disable;
    Args.push_back(..., ConstantInt::get(AttrVal));
}
```



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69628/new/

https://reviews.llvm.org/D69628





More information about the cfe-commits mailing list