File tree Expand file tree Collapse file tree 2 files changed +29
-29
lines changed
include/llvm/Transforms/Scalar Expand file tree Collapse file tree 2 files changed +29
-29
lines changed Original file line number Diff line number Diff line change @@ -403,4 +403,33 @@ struct GVNSinkPass : PassInfoMixin<GVNSinkPass> {
403
403
404
404
} // end namespace llvm
405
405
406
+ struct llvm ::GVNPass::Expression {
407
+ uint32_t opcode;
408
+ bool commutative = false ;
409
+ // The type is not necessarily the result type of the expression, it may be
410
+ // any additional type needed to disambiguate the expression.
411
+ Type *type = nullptr ;
412
+ SmallVector<uint32_t , 4 > varargs;
413
+
414
+ Expression (uint32_t o = ~2U ) : opcode(o) {}
415
+
416
+ bool operator ==(const Expression &other) const {
417
+ if (opcode != other.opcode )
418
+ return false ;
419
+ if (opcode == ~0U || opcode == ~1U )
420
+ return true ;
421
+ if (type != other.type )
422
+ return false ;
423
+ if (varargs != other.varargs )
424
+ return false ;
425
+ return true ;
426
+ }
427
+
428
+ friend hash_code hash_value (const Expression &Value) {
429
+ return hash_combine (
430
+ Value.opcode , Value.type ,
431
+ hash_combine_range (Value.varargs .begin (), Value.varargs .end ()));
432
+ }
433
+ };
434
+
406
435
#endif // LLVM_TRANSFORMS_SCALAR_GVN_H
Original file line number Diff line number Diff line change @@ -135,35 +135,6 @@ static cl::opt<uint32_t> MaxNumInsnsPerBlock(
135
135
cl::desc(" Max number of instructions to scan in each basic block in GVN "
136
136
" (default = 100)" ));
137
137
138
- struct llvm ::GVNPass::Expression {
139
- uint32_t opcode;
140
- bool commutative = false ;
141
- // The type is not necessarily the result type of the expression, it may be
142
- // any additional type needed to disambiguate the expression.
143
- Type *type = nullptr ;
144
- SmallVector<uint32_t , 4 > varargs;
145
-
146
- Expression (uint32_t o = ~2U ) : opcode(o) {}
147
-
148
- bool operator ==(const Expression &other) const {
149
- if (opcode != other.opcode )
150
- return false ;
151
- if (opcode == ~0U || opcode == ~1U )
152
- return true ;
153
- if (type != other.type )
154
- return false ;
155
- if (varargs != other.varargs )
156
- return false ;
157
- return true ;
158
- }
159
-
160
- friend hash_code hash_value (const Expression &Value) {
161
- return hash_combine (
162
- Value.opcode , Value.type ,
163
- hash_combine_range (Value.varargs .begin (), Value.varargs .end ()));
164
- }
165
- };
166
-
167
138
namespace llvm {
168
139
169
140
template <> struct DenseMapInfo <GVNPass::Expression> {
You can’t perform that action at this time.
0 commit comments