From 4bb78e2cb08fdd0b231ea724626606f5b5a80f25 Mon Sep 17 00:00:00 2001 From: Juneyoung Lee Date: Sun, 21 Mar 2021 02:14:06 +0900 Subject: [PATCH] [CFLGraph] Fix a crash due to missing handling of freeze https://reviews.llvm.org/D85534#2636321 --- lib/Analysis/CFLGraph.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Analysis/CFLGraph.h b/lib/Analysis/CFLGraph.h index 21842ed3648..02a13d673f4 100644 --- a/lib/Analysis/CFLGraph.h +++ b/lib/Analysis/CFLGraph.h @@ -284,6 +284,13 @@ template 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);