diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp --- a/flang/lib/Lower/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP.cpp @@ -222,20 +222,20 @@ // omp.section { // fir.allocate for `private`/`firstprivate` // - // scf.if %true { + // fir.if %true { // ^%lpv_update_blk // } // } // } // // To keep code consistency while handling privatization - // through this control flow, add a `scf.if` operation + // through this control flow, add a `fir.if` operation // that always evaluates to true, in order to create // a dedicated sub-region in `omp.section` where // lastprivate FIR can reside. Later canonicalizations // will optimize away this operation. - mlir::scf::IfOp ifOp = firOpBuilder.create( + auto ifOp = firOpBuilder.create( op->getLoc(), firOpBuilder.createIntegerConstant( op->getLoc(), firOpBuilder.getIntegerType(1), 0x1), @@ -280,7 +280,7 @@ // omp.wsloop { ... // ... store // store ===> %cmp = llvm.icmp "eq" %iv %ub - // omp.yield scf.if %cmp { + // omp.yield fir.if %cmp { // } ^%lpv_update_blk: // } // omp.yield @@ -295,8 +295,8 @@ op->getRegion(0).front().getArguments()[0], mlir::dyn_cast(op).getUpperBound()[0]); } - mlir::scf::IfOp ifOp = firOpBuilder.create( - op->getLoc(), cmpOp, /*else*/ false); + auto ifOp = + firOpBuilder.create(op->getLoc(), cmpOp, /*else*/ false); firOpBuilder.setInsertionPointToStart(&ifOp.getThenRegion().front()); lastPrivIP = firOpBuilder.saveInsertionPoint(); } else { diff --git a/flang/test/Lower/OpenMP/parallel-lastprivate-clause-scalar.f90 b/flang/test/Lower/OpenMP/parallel-lastprivate-clause-scalar.f90 --- a/flang/test/Lower/OpenMP/parallel-lastprivate-clause-scalar.f90 +++ b/flang/test/Lower/OpenMP/parallel-lastprivate-clause-scalar.f90 @@ -25,7 +25,7 @@ ! Testing last iteration check !CHECK-NEXT: %[[IV_CMP:.*]] = arith.cmpi eq, %[[INDX_WS]] -!CHECK: scf.if %[[IV_CMP]] { +!CHECK: fir.if %[[IV_CMP]] { ! Testing lastprivate val update !CHECK-DAG: %[[CVT:.*]] = fir.convert %[[ARG1_REF]] : (!fir.ref>) -> !fir.ref @@ -53,7 +53,7 @@ ! Testing last iteration check !CHECK-DAG: %[[IV_CMP:.*]] = arith.cmpi eq, %[[INDX_WS]] -!CHECK-DAG: scf.if %[[IV_CMP]] { +!CHECK-DAG: fir.if %[[IV_CMP]] { ! Testing lastprivate val update !CHECK-NEXT: %[[CLONE_LD:.*]] = fir.load %[[CLONE]] : !fir.ref @@ -82,7 +82,7 @@ ! Testing last iteration check !CHECK: %[[IV_CMP1:.*]] = arith.cmpi eq, %[[INDX_WS]] -!CHECK-NEXT: scf.if %[[IV_CMP1]] { +!CHECK-NEXT: fir.if %[[IV_CMP1]] { ! Testing lastprivate val update !CHECK-DAG: %[[CLONE_LD1:.*]] = fir.load %[[CLONE1]] : !fir.ref !CHECK-DAG: fir.store %[[CLONE_LD1]] to %[[ARG1]] : !fir.ref @@ -113,7 +113,7 @@ !Testing last iteration check !CHECK: %[[IV_CMP1:.*]] = arith.cmpi eq, %[[INDX_WS]] -!CHECK-NEXT: scf.if %[[IV_CMP1]] { +!CHECK-NEXT: fir.if %[[IV_CMP1]] { !Testing lastprivate val update !CHECK-DAG: %[[CLONE_LD2:.*]] = fir.load %[[CLONE2]] : !fir.ref !CHECK-DAG: fir.store %[[CLONE_LD2]] to %[[ARG2]] : !fir.ref @@ -149,7 +149,7 @@ ! Testing last iteration check !CHECK: %[[IV_CMP1:.*]] = arith.cmpi eq, %[[INDX_WS]] -!CHECK-NEXT: scf.if %[[IV_CMP1]] { +!CHECK-NEXT: fir.if %[[IV_CMP1]] { ! Testing lastprivate val update !CHECK-NEXT: %[[CLONE_LD:.*]] = fir.load %[[CLONE2]] : !fir.ref !CHECK-NEXT: fir.store %[[CLONE_LD]] to %[[ARG2]] : !fir.ref @@ -180,7 +180,7 @@ !CHECK: omp.wsloop for (%[[INDX_WS:.*]]) : {{.*}} { ! Testing last iteration check !CHECK: %[[IV_CMP1:.*]] = arith.cmpi eq, %[[INDX_WS]] -!CHECK-NEXT: scf.if %[[IV_CMP1]] { +!CHECK-NEXT: fir.if %[[IV_CMP1]] { ! Testing lastprivate val update !CHECK-NEXT: %[[CLONE_LD:.*]] = fir.load %[[CLONE1]] : !fir.ref !CHECK-NEXT: fir.store %[[CLONE_LD]] to %[[ARG1]] : !fir.ref diff --git a/flang/test/Lower/OpenMP/sections.f90 b/flang/test/Lower/OpenMP/sections.f90 --- a/flang/test/Lower/OpenMP/sections.f90 +++ b/flang/test/Lower/OpenMP/sections.f90 @@ -131,7 +131,7 @@ !CHECK: %[[const:.*]] = arith.constant 1 : i32 !CHECK: %[[result:.*]] = arith.addi %[[temp]], %[[const]] : i32 !CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: scf.if %[[true]] { +!CHECK: fir.if %[[true]] { !CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref !CHECK: fir.store %[[temp]] to %[[X]] : !fir.ref !CHECK: } @@ -168,7 +168,7 @@ !CHECK: %[[const:.*]] = arith.constant 1 : i32 !CHECK: %[[result:.*]] = arith.addi %[[temp]], %[[const]] : i32 !CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: scf.if %true { +!CHECK: fir.if %true { !CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref !CHECK: fir.store %[[temp]] to %[[X]] : !fir.ref !CHECK: } @@ -205,7 +205,7 @@ !CHECK: %[[const:.*]] = arith.constant 1 : i32 !CHECK: %[[result:.*]] = arith.addi %[[temp]], %[[const]] : i32 !CHECK: fir.store %[[result]] to %[[PRIVATE_X]] : !fir.ref -!CHECK: scf.if %true { +!CHECK: fir.if %true { !CHECK: %[[temp:.*]] = fir.load %[[PRIVATE_X]] : !fir.ref !CHECK: fir.store %[[temp]] to %[[X]] : !fir.ref !CHECK: omp.barrier