39
39
#include " llvm/IR/Value.h"
40
40
#include " llvm/InitializePasses.h"
41
41
#include " llvm/Support/Casting.h"
42
- #include " llvm/Support/CommandLine.h"
43
42
#include " llvm/Transforms/Utils/Local.h"
44
43
#include < cassert>
45
44
#include < cstdint>
@@ -51,28 +50,6 @@ using namespace llvm;
51
50
52
51
#define DEBUG_TYPE " scalarizer"
53
52
54
- static cl::opt<bool > ClScalarizeVariableInsertExtract (
55
- " scalarize-variable-insert-extract" , cl::init(true ), cl::Hidden,
56
- cl::desc(" Allow the scalarizer pass to scalarize "
57
- " insertelement/extractelement with variable index" ));
58
-
59
- // This is disabled by default because having separate loads and stores
60
- // makes it more likely that the -combiner-alias-analysis limits will be
61
- // reached.
62
- static cl::opt<bool > ClScalarizeLoadStore (
63
- " scalarize-load-store" , cl::init(false ), cl::Hidden,
64
- cl::desc(" Allow the scalarizer pass to scalarize loads and store" ));
65
-
66
- // Split vectors larger than this size into fragments, where each fragment is
67
- // either a vector no larger than this size or a scalar.
68
- //
69
- // Instructions with operands or results of different sizes that would be split
70
- // into a different number of fragments are currently left as-is.
71
- static cl::opt<unsigned > ClScalarizeMinBits (
72
- " scalarize-min-bits" , cl::init(0 ), cl::Hidden,
73
- cl::desc(" Instruct the scalarizer pass to attempt to keep values of a "
74
- " minimum number of bits" ));
75
-
76
53
namespace {
77
54
78
55
BasicBlock::iterator skipPastPhiNodesAndDbg (BasicBlock::iterator Itr) {
@@ -273,24 +250,14 @@ static Value *concatenate(IRBuilder<> &Builder, ArrayRef<Value *> Fragments,
273
250
return Res;
274
251
}
275
252
276
- template <typename T>
277
- T getWithDefaultOverride (const cl::opt<T> &ClOption,
278
- const std::optional<T> &DefaultOverride) {
279
- return ClOption.getNumOccurrences () ? ClOption
280
- : DefaultOverride.value_or (ClOption);
281
- }
282
-
283
253
class ScalarizerVisitor : public InstVisitor <ScalarizerVisitor, bool > {
284
254
public:
285
255
ScalarizerVisitor (DominatorTree *DT, const TargetTransformInfo *TTI,
286
256
ScalarizerPassOptions Options)
287
- : DT(DT), TTI(TTI), ScalarizeVariableInsertExtract(getWithDefaultOverride(
288
- ClScalarizeVariableInsertExtract,
289
- Options.ScalarizeVariableInsertExtract)),
290
- ScalarizeLoadStore (getWithDefaultOverride(ClScalarizeLoadStore,
291
- Options.ScalarizeLoadStore)),
292
- ScalarizeMinBits(getWithDefaultOverride(ClScalarizeMinBits,
293
- Options.ScalarizeMinBits)) {}
257
+ : DT(DT), TTI(TTI),
258
+ ScalarizeVariableInsertExtract (Options.ScalarizeVariableInsertExtract),
259
+ ScalarizeLoadStore(Options.ScalarizeLoadStore),
260
+ ScalarizeMinBits(Options.ScalarizeMinBits) {}
294
261
295
262
bool visit (Function &F);
296
263
0 commit comments