[Mlir-commits] [mlir] 8611909 - [mlir] Create lbOperands before op.setLowerBound

Vitaly Buka llvmlistbot at llvm.org
Mon May 2 22:24:03 PDT 2022


Author: Vitaly Buka
Date: 2022-05-02T22:23:51-07:00
New Revision: 8611909572701541408025f36e05dee088695a01

URL: https://github.com/llvm/llvm-project/commit/8611909572701541408025f36e05dee088695a01
DIFF: https://github.com/llvm/llvm-project/commit/8611909572701541408025f36e05dee088695a01.diff

LOG: [mlir] Create lbOperands before op.setLowerBound

To fix msan report like https://reviews.llvm.org/P8284

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D124575

Added: 
    

Modified: 
    mlir/lib/Dialect/Affine/Utils/Utils.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Affine/Utils/Utils.cpp b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
index 6d015f51b622f..ad6af0f72f200 100644
--- a/mlir/lib/Dialect/Affine/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
@@ -622,6 +622,10 @@ LogicalResult mlir::normalizeAffineFor(AffineForOp op) {
                      newUbExprs, opBuilder.getContext());
   canonicalizeMapAndOperands(&newUbMap, &ubOperands);
 
+  SmallVector<Value, 4> lbOperands(lb.getOperands().begin(),
+                                   lb.getOperands().begin() +
+                                       lb.getMap().getNumDims());
+
   // Normalize the loop.
   op.setUpperBound(ubOperands, newUbMap);
   op.setLowerBound({}, opBuilder.getConstantAffineMap(0));
@@ -630,9 +634,6 @@ LogicalResult mlir::normalizeAffineFor(AffineForOp op) {
   // Calculate the Value of new loopIV. Create affine.apply for the value of
   // the loopIV in normalized loop.
   opBuilder.setInsertionPointToStart(op.getBody());
-  SmallVector<Value, 4> lbOperands(lb.getOperands().begin(),
-                                   lb.getOperands().begin() +
-                                       lb.getMap().getNumDims());
   // Add an extra dim operand for loopIV.
   lbOperands.push_back(op.getInductionVar());
   // Add symbol operands from lower bound.


        


More information about the Mlir-commits mailing list