[flang-commits] [flang] 4c52a98 - [flang] Fix controlSuccessor chain for select type construct

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Sat Nov 5 07:11:49 PDT 2022


Author: Valentin Clement
Date: 2022-11-05T15:11:30+01:00
New Revision: 4c52a9879bfd978f31ed3c8b1e4e700b764bcf31

URL: https://github.com/llvm/llvm-project/commit/4c52a9879bfd978f31ed3c8b1e4e700b764bcf31
DIFF: https://github.com/llvm/llvm-project/commit/4c52a9879bfd978f31ed3c8b1e4e700b764bcf31.diff

LOG: [flang] Fix controlSuccessor chain for select type construct

Represent the select type statement + type guard statement
the same way the select case statement and case statement are represented.
controlSuccessor was not correctly attributed to the next type guard stmt.

Reviewed By: PeteSteinfeld, vdonaldson

Differential Revision: https://reviews.llvm.org/D137460

Added: 
    

Modified: 
    flang/lib/Lower/PFTBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/PFTBuilder.cpp b/flang/lib/Lower/PFTBuilder.cpp
index 62ec5adf7758..8f87e96c986c 100644
--- a/flang/lib/Lower/PFTBuilder.cpp
+++ b/flang/lib/Lower/PFTBuilder.cpp
@@ -904,8 +904,13 @@ class PFTBuilder {
           [&](const parser::SelectRankCaseStmt &) { eval.isNewBlock = true; },
           [&](const parser::SelectTypeStmt &s) {
             insertConstructName(s, parentConstruct);
+            lastConstructStmtEvaluation = &eval;
+          },
+          [&](const parser::TypeGuardStmt &) {
+            eval.isNewBlock = true;
+            lastConstructStmtEvaluation->controlSuccessor = &eval;
+            lastConstructStmtEvaluation = &eval;
           },
-          [&](const parser::TypeGuardStmt &) { eval.isNewBlock = true; },
 
           // Constructs - set (unstructured) construct exit targets
           [&](const parser::AssociateConstruct &) { setConstructExit(eval); },


        


More information about the flang-commits mailing list