Closed kumasento closed 2 years ago
Examples:
func @foo(%a: f32, %b: f32, %c: i1) -> f32 { %0 = scf.if %c -> f32 { %1 = arith.addf %a, %b : f32 scf.yield %1 : f32 } else { %1 = arith.mulf %a, %b : f32 scf.yield %1 : f32 } return %0 : f32 }
will be transformed to
func @foo(%arg0: f32, %arg1: f32, %arg2: i1) -> f32 { %0 = arith.addf %arg0, %arg1 : f32 %1 = arith.mulf %arg0, %arg1 : f32 %2 = select %arg2, %0, %1 : f32 return %2 : f32 }
func @foo(%A: memref<10xf32>, %a: f32, %cond: i1) { scf.if %cond { affine.store %a, %A[0] : memref<10xf32> } return }
func @foo(%arg0: memref<10xf32>, %arg1: f32, %arg2: i1) { %0 = affine.load %arg0[0] : memref<10xf32> %1 = select %arg2, %arg1, %0 : f32 affine.store %1, %arg0[0] : memref<10xf32> return }
Examples:
Without memref store
will be transformed to
With memref store
will be transformed to