@@ -75,7 +75,7 @@ ArrayRef<Attribute> transform::TransformState::getParams(Value value) const {
75
75
}
76
76
77
77
ArrayRef<Value>
78
- transform::TransformState::getPayloadValues (Value handleValue) const {
78
+ transform::TransformState::getPayloadValuesView (Value handleValue) const {
79
79
const ValueMapping &mapping = getMapping (handleValue).values ;
80
80
auto iter = mapping.find (handleValue);
81
81
assert (iter != mapping.end () && " cannot find mapping for value handle "
@@ -310,7 +310,7 @@ void transform::TransformState::forgetMapping(Value opHandle,
310
310
for (Operation *op : mappings.direct [opHandle])
311
311
dropMappingEntry (mappings.reverse , op, opHandle);
312
312
mappings.direct .erase (opHandle);
313
- #ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS
313
+ #ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
314
314
// Payload IR is removed from the mapping. This invalidates the respective
315
315
// iterators.
316
316
mappings.incrementTimestamp (opHandle);
@@ -322,6 +322,11 @@ void transform::TransformState::forgetMapping(Value opHandle,
322
322
for (Value resultHandle : resultHandles) {
323
323
Mappings &localMappings = getMapping (resultHandle);
324
324
dropMappingEntry (localMappings.values , resultHandle, opResult);
325
+ #ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
326
+ // Payload IR is removed from the mapping. This invalidates the respective
327
+ // iterators.
328
+ mappings.incrementTimestamp (resultHandle);
329
+ #endif // LLVM_ENABLE_ABI_BREAKING_CHECKS
325
330
dropMappingEntry (localMappings.reverseValues , opResult, resultHandle);
326
331
}
327
332
}
@@ -333,6 +338,11 @@ void transform::TransformState::forgetValueMapping(
333
338
for (Value payloadValue : mappings.reverseValues [valueHandle])
334
339
dropMappingEntry (mappings.reverseValues , payloadValue, valueHandle);
335
340
mappings.values .erase (valueHandle);
341
+ #ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
342
+ // Payload IR is removed from the mapping. This invalidates the respective
343
+ // iterators.
344
+ mappings.incrementTimestamp (valueHandle);
345
+ #endif // LLVM_ENABLE_ABI_BREAKING_CHECKS
336
346
337
347
for (Operation *payloadOp : payloadOperations) {
338
348
SmallVector<Value> opHandles;
@@ -342,7 +352,7 @@ void transform::TransformState::forgetValueMapping(
342
352
dropMappingEntry (localMappings.direct , opHandle, payloadOp);
343
353
dropMappingEntry (localMappings.reverse , payloadOp, opHandle);
344
354
345
- #ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS
355
+ #ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
346
356
// Payload IR is removed from the mapping. This invalidates the respective
347
357
// iterators.
348
358
localMappings.incrementTimestamp (opHandle);
@@ -439,6 +449,11 @@ transform::TransformState::replacePayloadValue(Value value, Value replacement) {
439
449
// between the handles and the IR objects
440
450
if (!replacement) {
441
451
dropMappingEntry (mappings.values , handle, value);
452
+ #ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
453
+ // Payload IR is removed from the mapping. This invalidates the respective
454
+ // iterators.
455
+ mappings.incrementTimestamp (handle);
456
+ #endif // LLVM_ENABLE_ABI_BREAKING_CHECKS
442
457
} else {
443
458
auto it = mappings.values .find (handle);
444
459
if (it == mappings.values .end ())
@@ -647,7 +662,7 @@ void transform::TransformState::recordValueHandleInvalidation(
647
662
OpOperand &valueHandle,
648
663
transform::TransformState::InvalidatedHandleMap &newlyInvalidated) const {
649
664
// Invalidate other handles to the same value.
650
- for (Value payloadValue : getPayloadValues (valueHandle.get ())) {
665
+ for (Value payloadValue : getPayloadValuesView (valueHandle.get ())) {
651
666
SmallVector<Value> otherValueHandles;
652
667
(void )getHandlesForPayloadValue (payloadValue, otherValueHandles);
653
668
for (Value otherHandle : otherValueHandles) {
@@ -785,7 +800,7 @@ checkRepeatedConsumptionInOperand(ArrayRef<T> payload,
785
800
void transform::TransformState::compactOpHandles () {
786
801
for (Value handle : opHandlesToCompact) {
787
802
Mappings &mappings = getMapping (handle, /* allowOutOfScope=*/ true );
788
- #ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS
803
+ #ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
789
804
if (llvm::find (mappings.direct [handle], nullptr ) !=
790
805
mappings.direct [handle].end ())
791
806
// Payload IR is removed from the mapping. This invalidates the respective
@@ -846,7 +861,7 @@ transform::TransformState::applyTransform(TransformOpInterface transform) {
846
861
FULL_LDBG (" --checkRepeatedConsumptionInOperand For Value\n " );
847
862
DiagnosedSilenceableFailure check =
848
863
checkRepeatedConsumptionInOperand<Value>(
849
- getPayloadValues (operand.get ()), transform,
864
+ getPayloadValuesView (operand.get ()), transform,
850
865
operand.getOperandNumber ());
851
866
if (!check.succeeded ()) {
852
867
FULL_LDBG (" ----FAILED\n " );
@@ -912,7 +927,7 @@ transform::TransformState::applyTransform(TransformOpInterface transform) {
912
927
continue ;
913
928
}
914
929
if (llvm::isa<TransformValueHandleTypeInterface>(operand.getType ())) {
915
- for (Value payloadValue : getPayloadValues (operand)) {
930
+ for (Value payloadValue : getPayloadValuesView (operand)) {
916
931
if (llvm::isa<OpResult>(payloadValue)) {
917
932
origAssociatedOps.push_back (payloadValue.getDefiningOp ());
918
933
continue ;
@@ -1170,19 +1185,6 @@ void transform::TransformResults::setParams(
1170
1185
this ->params .replace (position, params);
1171
1186
}
1172
1187
1173
- void transform::TransformResults::setValues (OpResult handle,
1174
- ValueRange values) {
1175
- int64_t position = handle.getResultNumber ();
1176
- assert (position < static_cast <int64_t >(this ->values .size ()) &&
1177
- " setting values for a non-existent handle" );
1178
- assert (this ->values [position].data () == nullptr && " values already set" );
1179
- assert (operations[position].data () == nullptr &&
1180
- " another kind of results already set" );
1181
- assert (params[position].data () == nullptr &&
1182
- " another kind of results already set" );
1183
- this ->values .replace (position, values);
1184
- }
1185
-
1186
1188
void transform::TransformResults::setMappedValues (
1187
1189
OpResult handle, ArrayRef<MappedValue> values) {
1188
1190
DiagnosedSilenceableFailure diag = dispatchMappedValues (
0 commit comments