diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-09-16 11:22:44 +0000 | 
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-09-16 11:22:44 +0000 | 
| commit | 1aaefbca24aba4fd9fa382b85606ef292c740529 (patch) | |
| tree | 8016f9ad7255a9c20120a64eab85a0c4c4151b84 | |
| parent | bfe6b35c7079495a418cf247ef3bec828b8abce9 (diff) | |
| download | bcm5719-llvm-1aaefbca24aba4fd9fa382b85606ef292c740529.tar.gz bcm5719-llvm-1aaefbca24aba4fd9fa382b85606ef292c740529.zip  | |
[VPlanSLP] Don't dereference a cast_or_null<VPInstruction> 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
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/VPlanSLP.cpp | 13 | 
1 files changed, 8 insertions, 5 deletions
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::MultiNodeOpTy, 4> VPlanSlp::reorderMultiNodeOps() {  void VPlanSlp::dumpBundle(ArrayRef<VPValue *> Values) {    dbgs() << " Ops: "; -  for (auto Op : Values) -    if (auto *Instr = cast_or_null<VPInstruction>(Op)->getUnderlyingInstr()) -      dbgs() << *Instr << " | "; -    else -      dbgs() << " nullptr | "; +  for (auto Op : Values) { +    if (auto *VPInstr = cast_or_null<VPInstruction>(Op)) +      if (auto *Instr = VPInstr->getUnderlyingInstr()) { +        dbgs() << *Instr << " | "; +        continue; +      } +    dbgs() << " nullptr | "; +  }    dbgs() << "\n";  }  | 

