Author: Roger Ferrer Ibáñez
Date: 2025-11-21T14:59:07+01:00
New Revision: 6a5231e2005edce724844354f17060c5dd3c68aa

URL: 
https://github.com/llvm/llvm-project/commit/6a5231e2005edce724844354f17060c5dd3c68aa
DIFF: 
https://github.com/llvm/llvm-project/commit/6a5231e2005edce724844354f17060c5dd3c68aa.diff

LOG: [clang][OpenMP][CodeGen] Use an else if instead of checking twice (#168776)

These two classes are mutually exclusive so avoid doing the two checks
when the first succeeded.

Added: 
    

Modified: 
    clang/lib/CodeGen/CGStmtOpenMP.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp 
b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index efc06a276267a..c33867da7ed5c 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1950,9 +1950,9 @@ class OMPTransformDirectiveScopeRAII {
       Scope = new OMPLoopScope(CGF, *Dir);
       CGSI = new CodeGenFunction::CGCapturedStmtInfo(CR_OpenMP);
       CapInfoRAII = new CodeGenFunction::CGCapturedStmtRAII(CGF, CGSI);
-    }
-    if (const auto *Dir =
-            dyn_cast<OMPCanonicalLoopSequenceTransformationDirective>(S)) {
+    } else if (const auto *Dir =
+                   dyn_cast<OMPCanonicalLoopSequenceTransformationDirective>(
+                       S)) {
       // For simplicity we reuse the loop scope similarly to what we do with
       // OMPCanonicalLoopNestTransformationDirective do by being a subclass
       // of OMPLoopBasedDirective.


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to