[llvm] 319d093 - [CFLGraph] Fix a crash due to missing handling of freeze

Juneyoung Lee via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 20 02:15:03 PDT 2021


Author: Juneyoung Lee
Date: 2021-03-21T02:14:13+09:00
New Revision: 319d093b87a89712573d159da019ce363ae51430

URL: https://github.com/llvm/llvm-project/commit/319d093b87a89712573d159da019ce363ae51430
DIFF: https://github.com/llvm/llvm-project/commit/319d093b87a89712573d159da019ce363ae51430.diff

LOG: [CFLGraph] Fix a crash due to missing handling of freeze

https://reviews.llvm.org/D85534#2636321

Added: 
    

Modified: 
    llvm/lib/Analysis/CFLGraph.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/CFLGraph.h b/llvm/lib/Analysis/CFLGraph.h
index 21842ed36487..02a13d673f40 100644
--- a/llvm/lib/Analysis/CFLGraph.h
+++ b/llvm/lib/Analysis/CFLGraph.h
@@ -284,6 +284,13 @@ template <typename CFLAA> class CFLGraphBuilder {
       addAssignEdge(Src, &Inst);
     }
 
+    void visitFreezeInst(FreezeInst &Inst) {
+      // Accessing freeze(ptr) is equivalent to accessing ptr.
+      // The former raises UB iff latter raises UB.
+      auto *Src = Inst.getOperand(0);
+      addAssignEdge(Src, &Inst);
+    }
+
     void visitBinaryOperator(BinaryOperator &Inst) {
       auto *Op1 = Inst.getOperand(0);
       auto *Op2 = Inst.getOperand(1);


        


More information about the llvm-commits mailing list