[llvm] Fix clang crash with -print-changed=dot-cfg (PR #148844)
Ruoyu Qiu via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 15 06:02:00 PDT 2025
https://github.com/cabbaken created https://github.com/llvm/llvm-project/pull/148844
Remove unnecessary comparison of Before and After `DCData`, which will cause an error when create `DotCfgDiff`.
Fixes: 148579
>From aa2a56a651903a27084f1ba4fe97e7913118caac Mon Sep 17 00:00:00 2001
From: Ruoyu Qiu <qiuruoyu at xiaomi.com>
Date: Tue, 15 Jul 2025 12:49:04 +0000
Subject: [PATCH] Fix clang crash with -print-changed=dot-cfg
Remove unnecessary comparison of Before and After `DCData`,
which will cause an error when create `DotCfgDiff`.
Signed-off-by: Ruoyu Qiu <cabbaken at outlook.com>
---
llvm/lib/Passes/StandardInstrumentations.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp
index 0623e66772047..bbd8ca430139c 100644
--- a/llvm/lib/Passes/StandardInstrumentations.cpp
+++ b/llvm/lib/Passes/StandardInstrumentations.cpp
@@ -1991,6 +1991,11 @@ DotCfgDiff::DotCfgDiff(StringRef Title, const FuncDataT<DCData> &Before,
EdgesMap.insert({Key, BeforeColour});
}
}
+ if (Before == After) {
+ for (auto &I : Nodes)
+ I.finalize(*this);
+ return;
+ }
// Handle each basic block in the after IR
for (auto &A : After.getData()) {
More information about the llvm-commits
mailing list