[llvm-branch-commits] [llvm] 4370dd4 - Fix use after free

Vitaly Buka via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 30 13:54:47 PDT 2024


Author: Vitaly Buka
Date: 2024-08-30T13:53:29-07:00
New Revision: 4370dd4bb5d3527e8ae5348b3c71d335d2feeb4f

URL: https://github.com/llvm/llvm-project/commit/4370dd4bb5d3527e8ae5348b3c71d335d2feeb4f
DIFF: https://github.com/llvm/llvm-project/commit/4370dd4bb5d3527e8ae5348b3c71d335d2feeb4f.diff

LOG: Fix use after free

Added: 
    

Modified: 
    llvm/lib/CodeGen/AtomicExpandPass.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AtomicExpandPass.cpp b/llvm/lib/CodeGen/AtomicExpandPass.cpp
index b9732e816ea7e6..d9843554860d63 100644
--- a/llvm/lib/CodeGen/AtomicExpandPass.cpp
+++ b/llvm/lib/CodeGen/AtomicExpandPass.cpp
@@ -368,7 +368,7 @@ bool AtomicExpandImpl::run(Function &F, const TargetMachine *TM) {
         // Detect control flow change and resume iteration from the original
         // block to inspect any newly inserted blocks. This allows incremental
         // legalizaton of atomicrmw and cmpxchg.
-        if (BB != Next->getParent()) {
+        if (Next == E || BB != Next->getParent()) {
           BBI = BB->getIterator();
           BBE = F.end();
           break;


        


More information about the llvm-branch-commits mailing list