Skip to content

Commit

Permalink
Fix GCC dangling pointer warning in ConfigTrackingListener (iree-org#…
Browse files Browse the repository at this point in the history
…19265)

Tentative fix for iree-org#19264
  • Loading branch information
qedawkins authored Nov 22, 2024
1 parent 4a5187d commit 12476d9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ class ConcretizePadResultShapePass final
MLIRContext *context = &getContext();
auto funcOp = getOperation();

ConfigTrackingListener listener;
{
RewritePatternSet patterns(context);
populateConcretizePadResultShapePatterns(patterns);
GreedyRewriteConfig config;
auto listener = ConfigTrackingListener();
config.listener = &listener;
if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns),
config))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ struct ConfigTrackingCanonicalizerPass final

void runOnOperation() override {
// Canonicalization is best-effort. Non-convergence is not a pass failure.
auto listener = ConfigTrackingListener();
config.listener = &listener;
LogicalResult didConverge =
applyPatternsAndFoldGreedily(getOperation(), *patterns, config);
if (this->testConvergence && failed(didConverge)) {
getOperation()->emitError("Canonicalizer failed to converge");
return signalPassFailure();
ConfigTrackingListener listener;
{
config.listener = &listener;
LogicalResult didConverge =
applyPatternsAndFoldGreedily(getOperation(), *patterns, config);
if (this->testConvergence && failed(didConverge)) {
getOperation()->emitError("Canonicalizer failed to converge");
return signalPassFailure();
}
}
}
GreedyRewriteConfig config;
Expand Down

0 comments on commit 12476d9

Please sign in to comment.