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