[PATCH] D54740: [NewPM] fixing asserts on deleted loop in -print-after-all

Philip Pfaffe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 7 06:39:01 PST 2018


philip.pfaffe added inline comments.


================
Comment at: lib/Passes/StandardInstrumentations.cpp:86
     const Loop *L = any_cast<const Loop *>(IR);
+    assert(L && "Loop should be valid for printing");
     const Function *F = L->getHeader()->getParent();
----------------
Is there a policy on assertions?

Those you added imho don't add value. You're asserting for nullptr, but are using the pointer unconditionally after. That's failing just as hard. The message on the other hand isn't very helpful I feel, since you're not actually testing loop //validity//, but whether a nullptr was stored in the any, which I don't think is the same thing (anymore?).




Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54740/new/

https://reviews.llvm.org/D54740





More information about the llvm-commits mailing list