File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -940,6 +940,9 @@ MLIR_CAPI_EXPORTED void mlirValueReplaceAllUsesOfWith(MlirValue of,
940
940
/// Returns whether the op operand is null.
941
941
MLIR_CAPI_EXPORTED bool mlirOpOperandIsNull (MlirOpOperand opOperand );
942
942
943
+ /// Returns the value of an op operand.
944
+ MLIR_CAPI_EXPORTED MlirValue mlirOpOperandGetValue (MlirOpOperand opOperand );
945
+
943
946
/// Returns the owner operation of an op operand.
944
947
MLIR_CAPI_EXPORTED MlirOperation mlirOpOperandGetOwner (MlirOpOperand opOperand );
945
948
Original file line number Diff line number Diff line change @@ -986,6 +986,10 @@ MlirOperation mlirOpOperandGetOwner(MlirOpOperand opOperand) {
986
986
return wrap (unwrap (opOperand)->getOwner ());
987
987
}
988
988
989
+ MlirValue mlirOpOperandGetValue (MlirOpOperand opOperand) {
990
+ return wrap (unwrap (opOperand)->get ());
991
+ }
992
+
989
993
unsigned mlirOpOperandGetOperandNumber (MlirOpOperand opOperand) {
990
994
return unwrap (opOperand)->getOperandNumber ();
991
995
}
Original file line number Diff line number Diff line change @@ -1970,6 +1970,15 @@ int testOperands(void) {
1970
1970
fprintf (stderr , "\n" );
1971
1971
// CHECK: Second replacement use owner: "dummy.op2"
1972
1972
1973
+ MlirOpOperand use5 = mlirValueGetFirstUse (constTwoValue );
1974
+ MlirOpOperand use6 = mlirOpOperandGetNextUse (use5 );
1975
+ if (!mlirValueEqual (mlirOpOperandGetValue (use5 ),
1976
+ mlirOpOperandGetValue (use6 ))) {
1977
+ fprintf (stderr ,
1978
+ "ERROR: First and second operand should share the same value\n" );
1979
+ return 5 ;
1980
+ }
1981
+
1973
1982
mlirOperationDestroy (op );
1974
1983
mlirOperationDestroy (op2 );
1975
1984
mlirOperationDestroy (constZero );
You can’t perform that action at this time.
0 commit comments