[flang][fir][NFC] Rename WhereOp to IfOp.

GitOrigin-RevId: f47d7c145b89985807c1e84316d091c5711f2e49
diff --git a/include/flang/Optimizer/Dialect/FIROps.td b/include/flang/Optimizer/Dialect/FIROps.td
index 918fdd4..a8d6107 100644
--- a/include/flang/Optimizer/Dialect/FIROps.td
+++ b/include/flang/Optimizer/Dialect/FIROps.td
@@ -1818,7 +1818,7 @@
 
 def fir_ResultOp : fir_Op<"result",
     [NoSideEffect, ReturnLike, Terminator,
-     ParentOneOf<["WhereOp", "DoLoopOp", "IterWhileOp"]>]> {
+     ParentOneOf<["IfOp", "DoLoopOp", "IterWhileOp"]>]> {
   let summary = "special terminator for use in fir region operations";
 
   let description = [{
@@ -1935,7 +1935,7 @@
   }];
 }
 
-def fir_WhereOp : region_Op<"if", [NoRegionArguments]> {
+def fir_IfOp : region_Op<"if", [NoRegionArguments]> {
   let summary = "if-then-else conditional operation";
   let description = [{
     Used to conditionally execute operations. This operation is the FIR
diff --git a/lib/Lower/IO.cpp b/lib/Lower/IO.cpp
index 9ce1a16..3c23eb2 100644
--- a/lib/Lower/IO.cpp
+++ b/lib/Lower/IO.cpp
@@ -178,8 +178,8 @@
   // loop scope.  That is done in genIoLoop, but it is enabled here.
   auto whereOp =
       inIterWhileLoop
-          ? builder.create<fir::WhereOp>(loc, builder.getI1Type(), ok, true)
-          : builder.create<fir::WhereOp>(loc, ok, /*withOtherwise=*/false);
+          ? builder.create<fir::IfOp>(loc, builder.getI1Type(), ok, true)
+          : builder.create<fir::IfOp>(loc, ok, /*withOtherwise=*/false);
   if (!insertPt.isSet())
     insertPt = builder.saveInsertionPoint();
   builder.setInsertionPointToStart(&whereOp.whereRegion().front());
@@ -411,9 +411,9 @@
   auto falseValue = builder.createIntegerConstant(loc, builder.getI1Type(), 0);
   genItemList(ioImpliedDo, true);
   // Unwind nested I/O call scopes, filling in true and false ResultOp's.
-  for (auto *op = builder.getBlock()->getParentOp(); isa<fir::WhereOp>(op);
+  for (auto *op = builder.getBlock()->getParentOp(); isa<fir::IfOp>(op);
        op = op->getBlock()->getParentOp()) {
-    auto whereOp = dyn_cast<fir::WhereOp>(op);
+    auto whereOp = dyn_cast<fir::IfOp>(op);
     auto *lastOp = &whereOp.whereRegion().front().back();
     builder.setInsertionPointAfter(lastOp);
     builder.create<fir::ResultOp>(loc, lastOp->getResult(0)); // runtime result
diff --git a/lib/Optimizer/Dialect/FIROps.cpp b/lib/Optimizer/Dialect/FIROps.cpp
index e1658fd..ed053fd 100644
--- a/lib/Optimizer/Dialect/FIROps.cpp
+++ b/lib/Optimizer/Dialect/FIROps.cpp
@@ -1396,34 +1396,34 @@
 }
 
 //===----------------------------------------------------------------------===//
-// WhereOp
+// IfOp
 //===----------------------------------------------------------------------===//
-void fir::WhereOp::build(mlir::OpBuilder &builder, OperationState &result,
-                         mlir::Value cond, bool withElseRegion) {
+void fir::IfOp::build(mlir::OpBuilder &builder, OperationState &result,
+                      mlir::Value cond, bool withElseRegion) {
   build(builder, result, llvm::None, cond, withElseRegion);
 }
 
-void fir::WhereOp::build(mlir::OpBuilder &builder, OperationState &result,
-                         mlir::TypeRange resultTypes, mlir::Value cond,
-                         bool withElseRegion) {
+void fir::IfOp::build(mlir::OpBuilder &builder, OperationState &result,
+                      mlir::TypeRange resultTypes, mlir::Value cond,
+                      bool withElseRegion) {
   result.addOperands(cond);
   result.addTypes(resultTypes);
 
   mlir::Region *thenRegion = result.addRegion();
   thenRegion->push_back(new mlir::Block());
   if (resultTypes.empty())
-    WhereOp::ensureTerminator(*thenRegion, builder, result.location);
+    fir::IfOp::ensureTerminator(*thenRegion, builder, result.location);
 
   mlir::Region *elseRegion = result.addRegion();
   if (withElseRegion) {
     elseRegion->push_back(new mlir::Block());
     if (resultTypes.empty())
-      WhereOp::ensureTerminator(*elseRegion, builder, result.location);
+      fir::IfOp::ensureTerminator(*elseRegion, builder, result.location);
   }
 }
 
-static mlir::ParseResult parseWhereOp(OpAsmParser &parser,
-                                      OperationState &result) {
+static mlir::ParseResult parseIfOp(OpAsmParser &parser,
+                                   OperationState &result) {
   result.regions.reserve(2);
   mlir::Region *thenRegion = result.addRegion();
   mlir::Region *elseRegion = result.addRegion();
@@ -1438,13 +1438,14 @@
   if (parser.parseRegion(*thenRegion, {}, {}))
     return mlir::failure();
 
-  WhereOp::ensureTerminator(*thenRegion, parser.getBuilder(), result.location);
+  fir::IfOp::ensureTerminator(*thenRegion, parser.getBuilder(),
+                              result.location);
 
   if (!parser.parseOptionalKeyword("else")) {
     if (parser.parseRegion(*elseRegion, {}, {}))
       return mlir::failure();
-    WhereOp::ensureTerminator(*elseRegion, parser.getBuilder(),
-                              result.location);
+    fir::IfOp::ensureTerminator(*elseRegion, parser.getBuilder(),
+                                result.location);
   }
 
   // Parse the optional attribute list.
@@ -1454,16 +1455,16 @@
   return mlir::success();
 }
 
-static LogicalResult verify(fir::WhereOp op) {
+static LogicalResult verify(fir::IfOp op) {
   if (op.getNumResults() != 0 && op.otherRegion().empty())
     return op.emitOpError("must have an else block if defining values");
 
   return mlir::success();
 }
 
-static void print(mlir::OpAsmPrinter &p, fir::WhereOp op) {
+static void print(mlir::OpAsmPrinter &p, fir::IfOp op) {
   bool printBlockTerminators = false;
-  p << fir::WhereOp::getOperationName() << ' ' << op.condition();
+  p << fir::IfOp::getOperationName() << ' ' << op.condition();
   if (!op.results().empty()) {
     p << " -> (" << op.getResultTypes() << ')';
     printBlockTerminators = true;