summaryrefslogtreecommitdiff
path: root/compiler/rustc_codegen_ssa/src/mir/statement.rs
diff options
context:
space:
mode:
authorBryan Garza <1396101+bryangarza@users.noreply.github.com>2022-12-20 00:51:17 +0000
committerBryan Garza <1396101+bryangarza@users.noreply.github.com>2023-01-23 23:56:22 +0000
commit360db516ccf358bd4b35c483ae44634a74c66c0b (patch)
treeb93ee5a07bbfa3db492ba3baaa26f645b4252121 /compiler/rustc_codegen_ssa/src/mir/statement.rs
parentc8e6a9e8b6251bbc8276cb78cabe1998deecbed7 (diff)
downloadrust-360db516ccf358bd4b35c483ae44634a74c66c0b.tar.gz
Create stable metric to measure long computation in Const Eval
This patch adds a `MirPass` that tracks the number of back-edges and function calls in the CFG, adds a new MIR instruction to increment a counter every time they are encountered during Const Eval, and emit a warning if a configured limit is breached.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/mir/statement.rs')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/statement.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/statement.rs b/compiler/rustc_codegen_ssa/src/mir/statement.rs
index 19452c8cdc8..60fbceb344d 100644
--- a/compiler/rustc_codegen_ssa/src/mir/statement.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/statement.rs
@@ -91,6 +91,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
mir::StatementKind::FakeRead(..)
| mir::StatementKind::Retag { .. }
| mir::StatementKind::AscribeUserType(..)
+ | mir::StatementKind::ConstEvalCounter
| mir::StatementKind::Nop => {}
}
}