[PATCH] D78277: [SimpleLoopUnswitch] Update DefaultExit condition to check unreachable is not empty.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 18:12:27 PDT 2020


efriedma added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:614
+    bool isUnreachable = isa<UnreachableInst>(TI);
+    return !isUnreachable || (isUnreachable && (&*BBToCheck.begin() != TI));
+  };
----------------
asbirlea wrote:
> chandlerc wrote:
> > efriedma wrote:
> > > Need to skip debug info
> > I hadn't expected that to matter as the thing we care most about here are the empty-but-unreachable blocks *created* by this same pass (and those would never have debug info).
> > 
> > But I suppose you're right that we still need to skip debug info because then the frontend adding it could suddenly enable (pointless) unswitching.
> > 
> > Ugh, but good catch.
> Just to clarify, when `TI` is an unreachable, the check should instead traverse `BBToCheck` and verify that if any instructions beside `TI` exists, they are an `IntrinsicInstr` and `I->getIntrinsicID()` is one of: `Intrinsic::dbg_addr`, `Intrinsic::dbg_declare`, `Intrinsic::dbg_label` or `Intrinsic::dbg_value`.
> Is this right, or is there a simpler way to add this check?
> 
> Thanks for the input!
`BBToCheck()->getFirstNonPHIOrDbg() != TI`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78277





More information about the llvm-commits mailing list