1. Nov 04, 2023
    • Simon Pilgrim's avatar
      [X86] X86ISelLowering.cpp - use StringRef::starts_with/ends_with instead of... · 6b29279a
      Simon Pilgrim authored
      [X86] X86ISelLowering.cpp - use StringRef::starts_with/ends_with instead of startswith/endswith. NFC.
      
      startswith/endswith wrap starts_with/ends_with and will eventually go away (to more closely match string_view)
      6b29279a
    • Philip Reames's avatar
      [indvars] Support known positive extends in getExtendedOperandRecurrence (#70990) · 1ffea97f
      Philip Reames authored
      IndVars has the existing notion of a narrow definition which is known to
      positive and thus both sign and zero extension kinds are actually the
      same operations. There's existing logic for forming a SCEV based on the
      extension kind and the no-wrap flags. This change extends that logic to
      form the opposite extension kind for a positive def if doing so is
      allowed by the flags. Note that we already do something analogous for
      the getWideRecurrence case as well.
      1ffea97f
    • Philip Reames's avatar
      [indvars] Add tests for countdown style loops w/nonnegative IVs · 7ca0f441
      Philip Reames authored
      Adding test coverage in advance of upcoming changes.  Note that these
      tests specifically use unsigned comparisons for the backends, the
      signed versions are fairly well handled by existing logic.
      7ca0f441
    • Craig Topper's avatar
      [Mips] In LowerShift*Parts, xor with bits-1 instead of -1. (#71149) · 8d24d390
      Craig Topper authored
      If we start with an i128 shift, the initial shift amount would usually
      have zeros in bit 8 and above. xoring the shift amount with -1 will set
      those upper bits to 1. If DAGCombiner is able to prove those bits are
      now 1, then the shift that uses the xor will be replaced with undef.
      Which we don't want.
      
      Reduce the xor constant to VT.bits-1 where VT is half the size of the
      larger shift type. This avoids toggling the upper bits. The hardware
      shift instruction only uses the lower bits of the shift amount. I assume
      the code used NOT because the hardware doesn't use the upper bits, but
      that isn't compatible with the LLVM poison semantics.
      
      Fixes #71142.
      8d24d390
    • Craig Topper's avatar
      [RISCV][GISel] Add helper to convert a LLT size to a... · 7ccdad14
      Craig Topper authored
      [RISCV][GISel] Add helper to convert a LLT size to a RegisterBankInfo::ValueMapping* for FP. (#71123)
      
      Use this to simplify code.
      7ccdad14
    • Ellis Hoag's avatar
      [InstrProf] Do not block functions from PGOUse (#71106) · 890335bb
      Ellis Hoag authored
      The `skipPGO()` function was added in https://reviews.llvm.org/D137184.
      Unfortunately, it also blocked functions from being annotated (PGOUse),
      which I believe will cause confusion to users if a function has a
      profile but it is not PGO'd.
      
      The docs for `noprofile` and `skipprofile` only claim to block
      instrumentation, not PGO optimization:
      https://llvm.org/docs/LangRef.html
      890335bb
    • Nick Desaulniers's avatar
      [InlineAsm] Steal a bit to denote a register is foldable (#70738) · 778a4846
      Nick Desaulniers authored
      
      When using the inline asm constraint string "rm" (or "g"), we generally
      would like the compiler to choose "r", but it is permitted to choose "m"
      if there's register pressure. This is distinct from "r" in which the
      register is not permitted to be spilled to the stack.
      
      The decision of which to use must be made at some point.  Currently, the
      instruction selection frameworks (ISELs) make the choice, and the
      register allocators had better be able to handle the result.
      
      Steal a bit from Storage when using register operands to disambiguate
      between the two cases.  Add helpers/getters/setters, and print in MIR
      when such a register is foldable.
      
      The getter will later be used by the register allocation frameworks (and
      asserted by the ISELs) while the setters will be used by the instruction
      selection frameworks.
      
      Link: https://github.com/llvm/llvm-project/issues/20571
      778a4846
    • Daniel Thornburgh's avatar
      [lldb] Use get-task-allow entitlement on macOS too (#71112) · 17798ad7
      Daniel Thornburgh authored
      Running the LLDB test suite in a GUI-less macOS environment (say, ssh)
      requires that the debugged tasks be signed with the get-task-allow
      entitlement.
      17798ad7
    • Philip Reames's avatar
      [IndVars] Generate zext nneg when locally obvious · a6c8e27b
      Philip Reames authored
      zext nneg was recently added to the IR in #67982.  This patch teaches
      SimplifyIndVars to prefer zext nneg over *both* sext and plain zext,
      when a local SCEV query indicates the source is non-negative.
      
      The choice to prefer zext nneg over sext looks slightly aggressive
      here, but probably isn't so much in practice.  For cases where we'd
      "remember" the range fact, instcombine would convert the sext into
      a zext nneg anyways.  The only cases where this produces a different
      result overall are when SCEV knows a non-local fact, and it doesn't
      get materialized into the IR.  Those are exactly the cases where
      using zext nneg are most useful.  We do run the risk of e.g. a
      missing combine - since we haven't updated most of them yet - but
      that seems like a manageable risk.
      
      Note that there are much deeper algorithmic changes we could make
      to this code to exploit zext nneg, but this seemed like a reasonable
      and low risk starting point.
      a6c8e27b
    • Min-Yih Hsu's avatar
      [RISCV] CSE by swapping conditional branches (#71111) · 1e39575a
      Min-Yih Hsu authored
      DAGCombiner, as well as InstCombine, tend to canonicalize GE/LE into
      GT/LT, namely:
      ```
      X >= C --> X > (C - 1)
      ```
      Which sometime generates off-by-one constants that could have been CSE'd
      with surrounding constants.
      Instead of changing such canonicalization, this patch tries to swap
      those branch conditions post-isel, in the hope of resurfacing more
      constant CSE opportunities. More specifically, it performs the following
      optimization:
      
      For two constants C0 and C1 from
      ```
      li Y, C0
      li Z, C1
      ```
      To remove redundnat `li Y, C0`,
       1. if C1 = C0 + 1 we can turn: 
          (a) blt Y, X -> bge X, Z
          (b) bge Y, X -> blt X, Z
       2. if C1 = C0 - 1 we can turn: 
          (a) blt X, Y -> bge Z, X
          (b) bge X, Y -> blt Z, X
      
      This optimization will be done by PeepholeOptimizer through
      RISCVInstrInfo::optimizeCondBranch.
      1e39575a
  2. Nov 03, 2023