[flang] Use value or * instead of getValue (NFC)
authorKazu Hirata <kazu@google.com>
Tue, 26 Jul 2022 06:01:01 +0000 (23:01 -0700)
committerKazu Hirata <kazu@google.com>
Tue, 26 Jul 2022 06:01:01 +0000 (23:01 -0700)
This patch replaces x.getValue() with *x if the reference is obviously
protected by a presence check.  Otherwise, it replaces x.getValue()
with x.value().

flang/lib/Lower/Bridge.cpp
flang/lib/Optimizer/Transforms/AffinePromotion.cpp

index f8662ad..05af25a 100644 (file)
@@ -2283,9 +2283,9 @@ private:
               }
               if (lhsIsWholeAllocatable)
                 fir::factory::finalizeRealloc(
-                    *builder, loc, lhsMutableBox.getValue(),
+                    *builder, loc, lhsMutableBox.value(),
                     /*lbounds=*/llvm::None, /*takeLboundsIfRealloc=*/false,
-                    lhsRealloc.getValue());
+                    lhsRealloc.value());
             },
 
             // [2] User defined assignment. If the context is a scalar
index 4d2aa0e..331d951 100644 (file)
@@ -175,7 +175,7 @@ struct AffineIfCondition {
 
   mlir::IntegerSet getIntegerSet() const {
     assert(hasIntegerSet() && "integer set is missing");
-    return integerSet.getValue();
+    return integerSet.value();
   }
 
   mlir::ValueRange getAffineArgs() const { return affineArgs; }
@@ -235,8 +235,8 @@ private:
     auto rhsAffine = toAffineExpr(cmpOp.getRhs());
     if (!lhsAffine || !rhsAffine)
       return;
-    auto constraintPair = constraint(
-        cmpOp.getPredicate(), rhsAffine.getValue() - lhsAffine.getValue());
+    auto constraintPair =
+        constraint(cmpOp.getPredicate(), *rhsAffine - *lhsAffine);
     if (!constraintPair)
       return;
     integerSet = mlir::IntegerSet::get(
@@ -481,8 +481,8 @@ private:
   std::pair<mlir::AffineForOp, mlir::Value>
   createAffineFor(fir::DoLoopOp op, mlir::PatternRewriter &rewriter) const {
     if (auto constantStep = constantIntegerLike(op.getStep()))
-      if (constantStep.getValue() > 0)
-        return positiveConstantStep(op, constantStep.getValue(), rewriter);
+      if (*constantStep > 0)
+        return positiveConstantStep(op, *constantStep, rewriter);
     return genericBounds(op, rewriter);
   }