From 88cfe54aeb36d0c9b5527e053436ced04d015277 Mon Sep 17 00:00:00 2001 From: kfcripps Date: Thu, 12 Sep 2024 19:01:12 -0700 Subject: [PATCH] Only process IR::Paths inside of IR::ParserState context Signed-off-by: kfcripps --- frontends/p4/moveDeclarations.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontends/p4/moveDeclarations.cpp b/frontends/p4/moveDeclarations.cpp index d6c7f5f0e23..12b366a7235 100644 --- a/frontends/p4/moveDeclarations.cpp +++ b/frontends/p4/moveDeclarations.cpp @@ -180,6 +180,8 @@ const IR::Node *MoveInitializers::postorder(IR::ParserState *state) { } const IR::Node *MoveInitializers::postorder(IR::Path *path) { + if (!findContext()) return path; + if (!oldStart || !loopsBackToStart || path->name != IR::ParserState::start) return path; // Only rename start state references if the parser contains initializing assignments