diff --git a/stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.cpp b/stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.cpp index c582693a4af..91d7c047b5c 100644 --- a/stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.cpp +++ b/stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.cpp @@ -508,7 +508,9 @@ LogicalResult StablehloLegalizeToTosaPass::initialize(MLIRContext* ctx) { } void StablehloLegalizeToTosaPass::runOnOperation() { - (void)applyPatternsAndFoldGreedily(getOperation(), patterns); + GreedyRewriteConfig config; + config.useTopDownTraversal = true; + (void)applyPatternsAndFoldGreedily(getOperation(), patterns, config); } } // namespace