From c1f13598822d57ce4c0c2589587c2bd97c99f42f Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Mon, 10 Jan 2022 15:34:24 +0000 Subject: [PATCH] [PGOInstrumentation] populateEHOperandBundle - earlyout if !isa All paths (that actually do anything) require a successful dyn_cast - so just earlyout if the cast fails Fixes static analyzer nullptr deference warning --- llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index b6ba1fc2132c..c46415e5b1f4 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -877,7 +877,10 @@ populateEHOperandBundle(VPCandidateInfo &Cand, DenseMap &BlockColors, SmallVectorImpl &OpBundles) { auto *OrigCall = dyn_cast(Cand.AnnotatedInst); - if (OrigCall && !isa(OrigCall)) { + if (!OrigCall) + return; + + if (!isa(OrigCall)) { // The instrumentation call should belong to the same funclet as a // non-intrinsic call, so just copy the operand bundle, if any exists. Optional ParentFunclet =