[llvm] c1f1359 - [PGOInstrumentation] populateEHOperandBundle - earlyout if !isa<CallBase>

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 10 07:35:39 PST 2022


Author: Simon Pilgrim
Date: 2022-01-10T15:34:37Z
New Revision: c1f13598822d57ce4c0c2589587c2bd97c99f42f

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

LOG: [PGOInstrumentation] populateEHOperandBundle - earlyout if !isa<CallBase>

All paths (that actually do anything) require a successful dyn_cast<CallBase> - so just earlyout if the cast fails

Fixes static analyzer nullptr deference warning

Added: 
    

Modified: 
    llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index b6ba1fc2132cb..c46415e5b1f4d 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -877,7 +877,10 @@ populateEHOperandBundle(VPCandidateInfo &Cand,
                         DenseMap<BasicBlock *, ColorVector> &BlockColors,
                         SmallVectorImpl<OperandBundleDef> &OpBundles) {
   auto *OrigCall = dyn_cast<CallBase>(Cand.AnnotatedInst);
-  if (OrigCall && !isa<IntrinsicInst>(OrigCall)) {
+  if (!OrigCall)
+    return;
+
+  if (!isa<IntrinsicInst>(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<OperandBundleUse> ParentFunclet =


        


More information about the llvm-commits mailing list