@@ -2367,7 +2367,7 @@ struct AffineForEmptyLoopFolder : public OpRewritePattern<AffineForOp> {
23672367 if (forOp.getNumResults () == 0 )
23682368 return success ();
23692369 std::optional<uint64_t > tripCount = getTrivialConstantTripCount (forOp);
2370- if (tripCount && *tripCount == 0 ) {
2370+ if (tripCount == 0 ) {
23712371 // The initial values of the iteration arguments would be the op's
23722372 // results.
23732373 rewriter.replaceOp (forOp, forOp.getInits ());
@@ -2447,7 +2447,7 @@ void AffineForOp::getSuccessorRegions(
24472447
24482448 // From the loop body, if the trip count is one, we can only branch back to
24492449 // the parent.
2450- if (!point.isParent () && tripCount && *tripCount == 1 ) {
2450+ if (!point.isParent () && tripCount == 1 ) {
24512451 regions.push_back (RegionSuccessor (getResults ()));
24522452 return ;
24532453 }
@@ -2460,8 +2460,7 @@ void AffineForOp::getSuccessorRegions(
24602460
24612461// / Returns true if the affine.for has zero iterations in trivial cases.
24622462static bool hasTrivialZeroTripCount (AffineForOp op) {
2463- std::optional<uint64_t > tripCount = getTrivialConstantTripCount (op);
2464- return tripCount && *tripCount == 0 ;
2463+ return getTrivialConstantTripCount (op) == 0 ;
24652464}
24662465
24672466LogicalResult AffineForOp::fold (FoldAdaptor adaptor,
@@ -4789,7 +4788,7 @@ struct DropUnitExtentBasis
47894788 llvm::enumerate (delinearizeOp.getPaddedBasis ())) {
47904789 std::optional<int64_t > basisVal =
47914790 basis ? getConstantIntValue (basis) : std::nullopt ;
4792- if (basisVal && *basisVal == 1 )
4791+ if (basisVal == 1 )
47934792 replacements[index] = getZero ();
47944793 else
47954794 newBasis.push_back (basis);
0 commit comments