]> granicus.if.org Git - llvm/commitdiff
[VPlanSLP] Don't dereference a cast_or_null<VPInstruction> result. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 16 Sep 2019 11:22:44 +0000 (11:22 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 16 Sep 2019 11:22:44 +0000 (11:22 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371975 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Vectorize/VPlanSLP.cpp

index e5ab24e52df6b6447811ebf275a55d9320a5abab..9019ed15ec5ff64aebfffbbac52bcdc21cb8f98e 100644 (file)
@@ -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";
 }