Skip to content
  1. Dec 04, 2017
    • Hiroshi Yamauchi's avatar
      Move splitIndirectCriticalEdges() to BasicBlockUtils.h. · 9364fa34
      Hiroshi Yamauchi authored
      Summary:
      Move splitIndirectCriticalEdges() from CodeGenPrepare to BasicBlockUtils.h so
      that it can be called from other places.
      
      Reviewers: davidxl
      
      Reviewed By: davidxl
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D40750
      
      llvm-svn: 319689
      9364fa34
    • Sanjoy Das's avatar
      [BypassSlowDivision] Improve our handling of divisions by constants · aa92cae1
      Sanjoy Das authored
      (This reapplies r314253.  r314253 was reverted on r314482 because of a
      correctness regression on P100, but that regression was identified to be
      something else.)
      
      Summary:
      Don't bail out on constant divisors for divisions that can be narrowed without
      introducing control flow .  This gives us a 32 bit multiply instead of an
      emulated 64 bit multiply in the generated PTX assembly.
      
      Reviewers: jlebar
      
      Subscribers: jholewinski, mcrosier, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D38265
      
      llvm-svn: 319677
      aa92cae1
    • Anna Thomas's avatar
      [Loop Predication] Teach LP about reverse loops · 7b360434
      Anna Thomas authored
      Summary:
      Currently, we only support predication for forward loops with step
      of 1.  This patch enables loop predication for reverse or
      countdownLoops, which satisfy the following conditions:
         1. The step of the IV is -1.
         2. The loop has a singe latch as B(X) = X <pred>
      latchLimit with pred as s> or u>
         3. The IV of the guard is the decrement
      IV of the latch condition (Guard is: G(X) = X-1 u< guardLimit).
      
      This patch was downstream for a while and is the last series of patches
      that's from our LP implementation downstream.
      
      Reviewers: apilipenko, mkazantsev, sanjoy
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D40353
      
      llvm-svn: 319659
      7b360434
  2. Dec 01, 2017
    • Philip Reames's avatar
      [IndVars] Fix a bug introduced in r317012 · 6260cf71
      Philip Reames authored
      Turns out we can have comparisons which are indirect users of the induction variable that we can make invariant.  In this case, there is no loop invariant value contributing and we'd fail an assert.
      
      The test case was found by a java fuzzer and reduced.  It's a real cornercase.  You have to have a static loop which we've already proven only executes once, but haven't broken the backedge on, and an inner phi whose result can be constant folded by SCEV using exit count reasoning but not proven by isKnownPredicate.  To my knowledge, only the fuzzer has hit this case.
      
      llvm-svn: 319583
      6260cf71
    • Hans Wennborg's avatar
      Revert r319531 "[SLPVectorizer] Failure to beneficially vectorize 'copyable'... · e2470b95
      Hans Wennborg authored
      Revert r319531 "[SLPVectorizer] Failure to beneficially vectorize 'copyable' elements in integer binary ops."
      
      It causes builds to fail with "Instruction does not dominate all uses" (PR35497).
      
      > Patch tries to improve vectorization of the following code:
      >
      > void add1(int * __restrict dst, const int * __restrict src) {
      >   *dst++ = *src++;
      >   *dst++ = *src++ + 1;
      >   *dst++ = *src++ + 2;
      >   *dst++ = *src++ + 3;
      > }
      > Allows to vectorize even if the very first operation is not a binary add, but just a load.
      >
      > Fixed issues related to previous commit.
      >
      > Reviewers: spatel, mzolotukhin, mkuper, hfinkel, RKSimon, filcab, ABataev
      >
      > Reviewed By: ABataev, RKSimon
      >
      > Subscribers: llvm-commits, RKSimon
      >
      > Differential Revision: https://reviews.llvm.org/D28907
      
      llvm-svn: 319550
      e2470b95
    • Mikael Holmen's avatar
      Revert r319537: Bail out of a SimplifyCFG switch table opt at undef values. · 9c13c8b6
      Mikael Holmen authored
      Broke build bots so reverting.
      
      llvm-svn: 319539
      9c13c8b6
    • Mikael Holmen's avatar
      Bail out of a SimplifyCFG switch table opt at undef values. · 9f047795
      Mikael Holmen authored
      Summary:
      A true or false result is expected from a comparison, but it seems the possibility of undef was overlooked, which could lead to a failed assert. This is fixed by this patch by bailing out if we encounter undef.
      
      The bug is old and the assert has been there since the end of 2014, so it seems this is unusual enough to forego optimization.
      
      Patch by: JesperAntonsson
      
      Reviewers: spatel, eeckstein, hans
      
      Reviewed By: hans
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D40639
      
      llvm-svn: 319537
      9f047795
    • Dinar Temirbulatov's avatar
      [SLPVectorizer] Failure to beneficially vectorize 'copyable' elements in integer binary ops. · 29e86584
      Dinar Temirbulatov authored
          
                  Patch tries to improve vectorization of the following code:
          
                  void add1(int * __restrict dst, const int * __restrict src) {
                    *dst++ = *src++;
                    *dst++ = *src++ + 1;
                    *dst++ = *src++ + 2;
                    *dst++ = *src++ + 3;
                  }
                  Allows to vectorize even if the very first operation is not a binary add, but just a load.
          
                  Fixed issues related to previous commit.
          
                  Reviewers: spatel, mzolotukhin, mkuper, hfinkel, RKSimon, filcab, ABataev
          
                  Reviewed By: ABataev, RKSimon
          
                  Subscribers: llvm-commits, RKSimon
          
                  Differential Revision: https://reviews.llvm.org/D28907
      
      llvm-svn: 319531
      29e86584
    • Hiroshi Inoue's avatar
      Recommit rL319407: [SROA] enable splitting for non-whole-alloca loads and stores · 48e4c7aa
      Hiroshi Inoue authored
      Recommiting once reverted patch rL319407 after adding a check for bit vector size to avoid failures in some build bots.
      
      llvm-svn: 319522
      48e4c7aa
    • Zachary Turner's avatar
      Mark all library options as hidden. · 8065f0b9
      Zachary Turner authored
      These command line options are not intended for public use, and often
      don't even make sense in the context of a particular tool anyway. About
      90% of them are already hidden, but when people add new options they
      forget to hide them, so if you were to make a brand new tool today, link
      against one of LLVM's libraries, and run tool -help you would get a
      bunch of junk that doesn't make sense for the tool you're writing.
      
      This patch hides these options. The real solution is to not have
      libraries defining command line options, but that's a much larger effort
      and not something I'm prepared to take on.
      
      Differential Revision: https://reviews.llvm.org/D40674
      
      llvm-svn: 319505
      8065f0b9
    • Peter Collingbourne's avatar
      ThinLTOBitcodeWriter: Try harder to discard unused references to the merged module. · 1f034226
      Peter Collingbourne authored
      If the thin module has no references to an internal global in the
      merged module, we need to make sure to preserve that property if the
      global is a member of a comdat group, as otherwise promotion can end
      up adding global symbols to the comdat, which is not allowed.
      
      This situation can arise if the external global in the thin module
      has dead constant users, which would cause use_empty() to return
      false and would cause us to try to promote it. To prevent this from
      happening, discard the dead constant users before asking whether a
      global is empty.
      
      Differential Revision: https://reviews.llvm.org/D40593
      
      llvm-svn: 319494
      1f034226
  3. Nov 30, 2017
  4. Nov 28, 2017
    • Adam Nemet's avatar
      Demote this opt remark to DEBUG. · 2e922890
      Adam Nemet authored
      From a random opt-stat output:
      
      Top 10 remarks:
        tailcallelim/tailcall          53%
        inline/AlwaysInline            13%
        gvn/LoadClobbered              13%
        inline/Inlined                  8%
        inline/TooCostly                2%
        inline/NoDefinition             2%
        licm/LoadWithLoopInvariantAddressInvalidated  2%
        licm/Hoisted                    1%
        asm-printer/InstructionCount    1%
        prologepilog/StackSize          1%
      
      llvm-svn: 319235
      2e922890
    • Adrian Prantl's avatar
      SROA: Don't create variable fragments that are outside of the variable. · 77d90b0c
      Adrian Prantl authored
      An alloca may be larger than a variable that is described to be stored
      there. Don't create a dbg.value for fragments that are outside of the
      variable.
      
      This fixes PR35447.
      https://bugs.llvm.org/show_bug.cgi?id=35447
      
      llvm-svn: 319230
      77d90b0c
    • Hans Wennborg's avatar
      EntryExitInstrumenter: set DebugLocs on the inserted call instructions (PR35412) · ca46db95
      Hans Wennborg authored
      Apparently the verifier requires that inlineable calls in a function
      with debug info have debug locations.
      
      llvm-svn: 319199
      ca46db95
    • Jonas Paulsson's avatar
      Use getStoreSize() in various places instead of 'BitSize >> 3'. · f0ff20f1
      Jonas Paulsson authored
      This is needed for cases when the memory access is not as big as the width of
      the data type. For instance, storing i1 (1 bit) would be done in a byte (8
      bits).
      
      Using 'BitSize >> 3' (or '/ 8') would e.g. give the memory access of an i1 a
      size of 0, which for instance makes alias analysis return NoAlias even when
      it shouldn't.
      
      There are no tests as this was done as a follow-up to the bugfix for the case
      where this was discovered (r318824). This handles more similar cases.
      
      Review: Björn Petterson
      https://reviews.llvm.org/D40339
      
      llvm-svn: 319173
      f0ff20f1
    • Chandler Carruth's avatar
      Add a new pass to speculate around PHI nodes with constant (integer) operands when profitable. · c34f789e
      Chandler Carruth authored
      The core idea is to (re-)introduce some redundancies where their cost is
      hidden by the cost of materializing immediates for constant operands of
      PHI nodes. When the cost of the redundancies is covered by this,
      avoiding materializing the immediate has numerous benefits:
      1) Less register pressure
      2) Potential for further folding / combining
      3) Potential for more efficient instructions due to immediate operand
      
      As a motivating example, consider the remarkably different cost on x86
      of a SHL instruction with an immediate operand versus a register
      operand.
      
      This pattern turns up surprisingly frequently, but is somewhat rarely
      obvious as a significant performance problem.
      
      The pass is entirely target independent, but it does rely on the target
      cost model in TTI to decide when to speculate things around the PHI
      node. I've included x86-focused tests, but any target that sets up its
      immediate cost model should benefit from this pass.
      
      There is probably more that can be done in this space, but the pass
      as-is is enough to get some important performance on our internal
      benchmarks, and should be generally performance neutral, but help with
      more extensive benchmarking is always welcome.
      
      One awkward part is that this pass has to be scheduled after
      *everything* that can eliminate these kinds of redundancies. This
      includes SimplifyCFG, GVN, etc. I'm open to suggestions about better
      places to put this. We could in theory make it part of the codegen pass
      pipeline, but there doesn't really seem to be a good reason for that --
      it isn't "lowering" in any sense and only relies on pretty standard cost
      model based TTI queries, so it seems to fit well with the "optimization"
      pipeline model. Still, further thoughts on the pipeline position are
      welcome.
      
      I've also only implemented this in the new pass manager. If folks are
      very interested, I can try to add it to the old PM as well, but I didn't
      really see much point (my use case is already switched over to the new
      PM).
      
      I've tested this pretty heavily without issue. A wide range of
      benchmarks internally show no change outside the noise, and I don't see
      any significant changes in SPEC either. However, the size class
      computation in tcmalloc is substantially improved by this, which turns
      into a 2% to 4% win on the hottest path through tcmalloc for us, so
      there are definitely important cases where this is going to make
      a substantial difference.
      
      Differential revision: https://reviews.llvm.org/D37467
      
      llvm-svn: 319164
      c34f789e
    • Florian Hahn's avatar
      [TailRecursionElimination] Skip debug intrinsics. · 25ea91a8
      Florian Hahn authored
      Summary:
      I think we do not need to analyze debug intrinsics here, as they should
      not impact codegen. This has 2 benefits: 1) slightly less work to do and
      2) avoiding generating optimization remarks for converting calls to
      debug intrinsics to tail calls, which are not really helpful for users.
      
      Based on work by Sander de Smalen.
      
      Reviewers: davide, trentxintong, aprantl
      
      Reviewed By: aprantl
      
      Subscribers: llvm-commits, JDevlieghere
      
      Tags: #debug-info
      
      Differential Revision: https://reviews.llvm.org/D40440
      
      llvm-svn: 319158
      25ea91a8
    • Max Kazantsev's avatar
      [GVN] Prevent ScalarPRE from hoisting across instructions that don't pass... · 11560722
      Max Kazantsev authored
      [GVN] Prevent ScalarPRE from hoisting across instructions that don't pass control flow to successors
      
      This is to address a problem similar to those in D37460 for Scalar PRE. We should not
      PRE across an instruction that may not pass execution to its successor unless it is safe
      to speculatively execute it.
      
      Differential Revision: https://reviews.llvm.org/D38619
      
      llvm-svn: 319147
      11560722
    • Rafael Espindola's avatar
      This reverts commit r319096 and r319097. · c06f55e1
      Rafael Espindola authored
      Revert "[SROA] Propagate !range metadata when moving loads."
      Revert "[Mem2Reg] Clang-format unformatted parts of this file. NFCI."
      
      Davide says they broke a bot.
      
      llvm-svn: 319131
      c06f55e1
    • Adrian Prantl's avatar
  5. Nov 27, 2017
  6. Nov 24, 2017
  7. Nov 23, 2017
  8. Nov 22, 2017
    • Davide Italiano's avatar
      [SCCP] Pick the right lattice value for constants. · b480b5c2
      Davide Italiano authored
      After the dataflow algorithm proves that an argument is constant,
      it replaces it value with the integer constant and drops the lattice
      value associated to the DEF.
      
      e.g. in the example we have @f() that's called twice:
      call @f(undef, ...)
      call @f(2, ...)
      
      `undef` MEET 2 = 2 so we replace the argument and all its uses with
      the constant 2.
      
      Shortly after, tryToReplaceWithConstantRange() tries to get the lattice
      value for the argument we just replaced, causing an assertion.
      This function is a little peculiar as it runs when we're doing replacement
      and not as part of the solver but still queries the solver.
      
      The fix is that of checking whether we replaced the value already and
      get a temporary lattice value for the constant.
      
      Thanks to Zhendong Su for the report!
      
      Fixes PR35357.
      
      llvm-svn: 318817
      b480b5c2
  9. Nov 21, 2017
Loading