llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Mainak Sil (MainakSil)

<details>
<summary>Changes</summary>

Summary:
This PR fixes the issue where the VecLib bitfield in CodeGenOptions.def is too 
small to accommodate the increasing number of vector libraries. Specifically, 
the bitfield size was previously set to 3, but with the introduction of more 
vector libraries (currently 9), the bitfield needed to be expanded to avoid 
potential issues in vectorization.

In this PR, I have increased the size of the VecLib bitfield from 3 to 4 to 
account for the additional libraries. This ensures that all 9 vector libraries 
are correctly encoded and available for use without errors.

Changes Made:
Modified: Increased the VecLib bitfield size from 3 to 4 in 
clang/include/clang/Basic/CodeGenOptions.def.

Motivation:
This change is necessary to ensure that all vector libraries are properly 
represented and selectable. The current limitation of the VecLib bitfield size 
was causing some vectorization opportunities to be lost when more than 3 bits 
were needed to represent the library options.

Closes:
Fixes https://github.com/llvm/llvm-project/issues/108704

---
Full diff: https://github.com/llvm/llvm-project/pull/108804.diff


1 Files Affected:

- (modified) clang/include/clang/Basic/CodeGenOptions.def (+6-1) 


``````````diff
diff --git a/clang/include/clang/Basic/CodeGenOptions.def 
b/clang/include/clang/Basic/CodeGenOptions.def
index b600198998d85b..2d5bb84d1cc59c 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -375,8 +375,13 @@ ENUM_CODEGENOPT(Inlining, InliningMethod, 2, 
NormalInlining)
 /// The maximum stack size a function can have to be considered for inlining.
 VALUE_CODEGENOPT(InlineMaxStackSize, 32, UINT_MAX)
 
+// Ensure the VecLib bitfield has enough space for future vector libraries.
+// If new vector libraries are added beyond the current limit of 16, this 
static assertion will fail.
+static_assert(static_cast<int>(llvm::driver::VectorLibrary::NoLibrary) <= 16, 
+              "The VecLib bitfield in CodeGenOptions needs to be expanded to 
support more vector libraries.");
+
 // Vector functions library to use.
-ENUM_CODEGENOPT(VecLib, llvm::driver::VectorLibrary, 3, 
llvm::driver::VectorLibrary::NoLibrary)
+ENUM_CODEGENOPT(VecLib, llvm::driver::VectorLibrary, 4, 
llvm::driver::VectorLibrary::NoLibrary)
 
 /// The default TLS model to use.
 ENUM_CODEGENOPT(DefaultTLSModel, TLSModel, 2, GeneralDynamicTLSModel)

``````````

</details>


https://github.com/llvm/llvm-project/pull/108804
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to