Author: Timm Baeder
Date: 2025-09-05T15:56:10+02:00
New Revision: 66e7168f5e19917f98d5983bf8f86a46203bc92a

URL: 
https://github.com/llvm/llvm-project/commit/66e7168f5e19917f98d5983bf8f86a46203bc92a
DIFF: 
https://github.com/llvm/llvm-project/commit/66e7168f5e19917f98d5983bf8f86a46203bc92a.diff

LOG: [clang][bytecode][NFC] Use an early return in CheckLoad (#157105)

If the block is not accessible, one of the check has to fail.

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/Interp.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/Interp.cpp 
b/clang/lib/AST/ByteCode/Interp.cpp
index f1b9104c04feb..b64ed8c2fb497 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -792,6 +792,7 @@ bool CheckLocalLoad(InterpState &S, CodePtr OpPC, const 
Block *B) {
 
 bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
                AccessKinds AK) {
+  // Block pointers are the only ones we can actually read from.
   if (!Ptr.isBlockPointer()) {
     if (Ptr.isZero()) {
       const auto &Src = S.Current->getSource(OpPC);
@@ -804,7 +805,6 @@ bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer 
&Ptr,
     return false;
   }
 
-  // Block pointers are the only ones we can actually read from.
   if (!Ptr.block()->isAccessible()) {
     if (!CheckLive(S, OpPC, Ptr, AK))
       return false;
@@ -812,8 +812,7 @@ bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer 
&Ptr,
       return false;
     if (!CheckDummy(S, OpPC, Ptr.block(), AK))
       return false;
-    if (!CheckWeak(S, OpPC, Ptr.block()))
-      return false;
+    return CheckWeak(S, OpPC, Ptr.block());
   }
 
   if (!CheckConstant(S, OpPC, Ptr))


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to