[llvm] Scalarizer: Replace cl::opts with pass parameters (PR #110645)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 14:26:21 PDT 2024


================
@@ -27,13 +27,25 @@ class Function;
 class FunctionPass;
 
 struct ScalarizerPassOptions {
-  // These options correspond 1:1 to cl::opt options defined in
-  // Scalarizer.cpp. When the cl::opt are specified, they take precedence.
-  // When the cl::opt are not specified, the present optional values allow to
-  // override the cl::opt's default values.
-  std::optional<bool> ScalarizeVariableInsertExtract;
-  std::optional<bool> ScalarizeLoadStore;
-  std::optional<unsigned> ScalarizeMinBits;
+  /// Instruct the scalarizer pass to attempt to keep values of a minimum number
+  /// of bits.
+
+  /// Split vectors larger than this size into fragments, where each fragment is
+  /// either a vector no larger than this size or a scalar.
+  ///
+  /// Instructions with operands or results of different sizes that would be
+  /// split into a different number of fragments are currently left as-is.
+  unsigned ScalarizeMinBits = 0;
+
+  /// Allow the scalarizer pass to scalarize insertelement/extractelement with
+  /// variable index.
+  bool ScalarizeVariableInsertExtract = true;
+
+  /// Allow the scalarizer pass to scalarize loads and store
+  ///
+  /// This is disabled by default because having separate loads and stores makes
+  /// it more likely that the -combiner-alias-analysis limits will be reached.
+  bool ScalarizeLoadStore = false;
----------------
farzonl wrote:

This doesn't impact how we set our load/store flag so mostly fine with this change. 
https://github.com/llvm/llvm-project/blob/38a8000f30aa87a51ac0598dae3cb9166084f6a0/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp#L91-L93

https://github.com/llvm/llvm-project/pull/110645


More information about the llvm-commits mailing list