From 1aaefbca24aba4fd9fa382b85606ef292c740529 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Mon, 16 Sep 2019 11:22:44 +0000 Subject: [VPlanSLP] Don't dereference a cast_or_null result. NFCI. The static analyzer is warning about a potential null dereference of the cast_or_null result, I've split the cast_or_null check from the ->getUnderlyingInstr() call to avoid this, but it appears that we weren't seeing any null pointers in the dumped bundles in the first place. llvm-svn: 371975 --- llvm/lib/Transforms/Vectorize/VPlanSLP.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'llvm/lib/Transforms/Vectorize') diff --git a/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp b/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp index e5ab24e52df..9019ed15ec5 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp @@ -346,11 +346,14 @@ SmallVector VPlanSlp::reorderMultiNodeOps() { void VPlanSlp::dumpBundle(ArrayRef Values) { dbgs() << " Ops: "; - for (auto Op : Values) - if (auto *Instr = cast_or_null(Op)->getUnderlyingInstr()) - dbgs() << *Instr << " | "; - else - dbgs() << " nullptr | "; + for (auto Op : Values) { + if (auto *VPInstr = cast_or_null(Op)) + if (auto *Instr = VPInstr->getUnderlyingInstr()) { + dbgs() << *Instr << " | "; + continue; + } + dbgs() << " nullptr | "; + } dbgs() << "\n"; } -- cgit v1.2.3