1. Jul 15, 2022
  2. Jul 14, 2022
    • Philip Reames's avatar
      [SCEVExpander] Allow udiv with isKnownNonZero(RHS) + add vscale case · 3bc09c7d
      Philip Reames authored
      Motivation here is to unblock LSRs ability to use ICmpZero uses - the major effect of which is to enable count down IVs. The test changes reflect this goal, but the potential impact is much broader since this isn't a change in LSR at all.
      
      SCEVExpander needs(*) to prove that expanding the expression is safe anywhere the SCEV expression is valid. In general, we can't expand any node which might fault (or exhibit UB) unless we can either a) prove it won't fault, or b) guard the faulting case. We'd been allowing non-zero constants here; this change extends it to non-zero values.
      
      vscale is never zero. This is already implemented in ValueTracking, and this change just adds the same logic in SCEV's range computation (which in turn drives isKnownNonZero). We should common up some logic here, but let's do that in separate changes.
      
      (*) As an aside, "needs" is such an interesting word here. First, we don't actually need to guard this at all; we could choose to emit a select for the RHS of ever udiv and remove this code entirely. Secondly, the property being checked here is way too strong. What the client actually needs is to expand the SCEV at some particular point in some particular loop. In the examples, the original urem dominates that loop and yet we completely ignore that information when analyzing legality. I don't plan to actively pursue either direction, just noting it for future reference.
      
      Differential Revision: https://reviews.llvm.org/D129710
      3bc09c7d
    • Dmitry Vyukov's avatar
      tsan: fix a bug in trace part switching · ab02680b
      Dmitry Vyukov authored
      Callers of TraceSwitchPart expect that TraceAcquire will always succeed
      after the call. It's possible that TryTraceFunc/TraceMutexLock in TraceSwitchPart
      that restore the current stack/mutexset filled the trace part exactly up
      to the TracePart::kAlignment gap and the next TraceAcquire won't succeed.
      Skip the alignment gap after writing initial stack/mutexset to avoid that.
      
      Reviewed By: melver
      
      Differential Revision: https://reviews.llvm.org/D129777
      ab02680b
    • Brendon Cahoon's avatar
      Revert "[UnifyLoopExits] Reduce number of guard blocks" · 58fec782
      Brendon Cahoon authored
      This reverts commit e13248ab.
      
      Need to revert because the transformation cannot occur for basic
      blocks that contain convergent instructions.
      58fec782
    • Dawid Jurczak's avatar
      d71128d9