Skip to content
  1. Dec 30, 2017
  2. Dec 28, 2017
  3. Dec 27, 2017
  4. Dec 24, 2017
  5. Dec 22, 2017
    • Guozhi Wei's avatar
      [SimplifyCFG] Don't do if-conversion if there is a long dependence chain · 33250340
      Guozhi Wei authored
      If after if-conversion, most of the instructions in this new BB construct a long and slow dependence chain, it may be slower than cmp/branch, even if the branch has a high miss rate, because the control dependence is transformed into data dependence, and control dependence can be speculated, and thus, the second part can execute in parallel with the first part on modern OOO processor.
      
      This patch checks for the long dependence chain, and give up if-conversion if find one.
      
      Differential Revision: https://reviews.llvm.org/D39352
      
      llvm-svn: 321377
      33250340
    • Easwaran Raman's avatar
      Add hasProfileData() to check if a function has profile data. NFC. · a17f2205
      Easwaran Raman authored
      Summary:
      This replaces calls to getEntryCount().hasValue() with hasProfileData
      that does the same thing. This refactoring is useful to do before adding
      synthetic function entry counts but also a useful cleanup IMO even
      otherwise. I have used hasProfileData instead of hasRealProfileData as
      David had earlier suggested since I think profile implies "real" and I
      use the phrase "synthetic entry count" and not "synthetic profile count"
      but I am fine calling it hasRealProfileData if you prefer.
      
      Reviewers: davidxl, silvas
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D41461
      
      llvm-svn: 321331
      a17f2205
  6. Dec 21, 2017
    • Michael Zolotukhin's avatar
      [SimplifyCFG] Avoid quadratic on a predecessors number behavior in instruction sinking. · ad371e0c
      Michael Zolotukhin authored
      If a block has N predecessors, then the current algorithm will try to
      sink common code to this block N times (whenever we visit a
      predecessor). Every attempt to sink the common code includes going
      through all predecessors, so the complexity of the algorithm becomes
      O(N^2).
      With this patch we try to sink common code only when we visit the block
      itself. With this, the complexity goes down to O(N).
      As a side effect, the moment the code is sunk is slightly different than
      before (the order of simplifications has been changed), that's why I had
      to adjust two tests (note that neither of the tests is supposed to test
      SimplifyCFG):
      * test/CodeGen/AArch64/arm64-jumptable.ll - changes in this test mimic
      the changes that previous implementation of SimplifyCFG would do.
      * test/CodeGen/ARM/avoid-cpsr-rmw.ll - in this test I disabled common
      code sinking by a command line flag.
      
      llvm-svn: 321236
      ad371e0c
  7. Dec 20, 2017
    • Matthew Simpson's avatar
      [ICP] Expose unconditional call promotion interface · cb35c5d5
      Matthew Simpson authored
      This patch modifies the indirect call promotion utilities by exposing and using
      an unconditional call promotion interface. The unconditional promotion
      interface (i.e., call promotion without creating an if-then-else) can be used
      if it's known that an indirect call has only one possible callee. The existing
      conditional promotion interface uses this unconditional interface to promote an
      indirect call after it has been versioned and placed within the "then" block.
      
      A consequence of unconditional promotion is that the fix-up operations for phi
      nodes in the normal destination of invoke instructions are changed. This is
      necessary because the existing implementation assumed that an invoke had been
      versioned, creating a "merge" block where a return value bitcast could be
      placed. In the new implementation, the edge between a promoted invoke's parent
      block and its normal destination is split if needed to add a bitcast for the
      return value. If the invoke is also versioned, the phi node merging the return
      value of the promoted and original invoke instructions is placed in the "merge"
      block.
      
      Differential Revision: https://reviews.llvm.org/D40751
      
      llvm-svn: 321210
      cb35c5d5
  8. Dec 18, 2017
  9. Dec 16, 2017
  10. Dec 15, 2017
  11. Dec 14, 2017
    • Sanjay Patel's avatar
      [SimplifyCFG] don't sink common insts too soon (PR34603) · 0ab0c1a2
      Sanjay Patel authored
      This should solve:
      https://bugs.llvm.org/show_bug.cgi?id=34603
      ...by preventing SimplifyCFG from altering redundant instructions before early-cse has a chance to run.
      It changes the default (canonical-forming) behavior of SimplifyCFG, so we're only doing the
      sinking transform later in the optimization pipeline.
      
      Differential Revision: https://reviews.llvm.org/D38566
      
      llvm-svn: 320749
      0ab0c1a2
    • Dorit Nuzman's avatar
      [LV] Support efficient vectorization of an induction with redundant casts · 4750c785
      Dorit Nuzman authored
      D30041 extended SCEVPredicateRewriter to improve handling of Phi nodes whose
      update chain involves casts; PSCEV can now build an AddRecurrence for some
      forms of such phi nodes, under the proper runtime overflow test. This means
      that we can identify such phi nodes as an induction, and the loop-vectorizer
      can now vectorize such inductions, however inefficiently. The vectorizer
      doesn't know that it can ignore the casts, and so it vectorizes them.
      
      This patch records the casts in the InductionDescriptor, so that they could
      be marked to be ignored for cost calculation (we use VecValuesToIgnore for
      that) and ignored for vectorization/widening/scalarization (i.e. treated as
      TriviallyDead).
      
      In addition to marking all these casts to be ignored, we also need to make
      sure that each cast is mapped to the right vector value in the vector loop body
      (be it a widened, vectorized, or scalarized induction). So whenever an
      induction phi is mapped to a vector value (during vectorization/widening/
      scalarization), we also map the respective cast instruction (if exists) to that
      vector value. (If the phi-update sequence of an induction involves more than one
      cast, then the above mapping to vector value is relevant only for the last cast
      of the sequence as we allow only the "last cast" to be used outside the
      induction update chain itself).
      
      This is the last step in addressing PR30654.
      
      llvm-svn: 320672
      4750c785
  12. Dec 13, 2017
  13. Dec 12, 2017
    • Hiroshi Yamauchi's avatar
      Split IndirectBr critical edges before PGO gen/use passes. · f3bda1da
      Hiroshi Yamauchi authored
      Summary:
      The PGO gen/use passes currently fail with an assert failure if there's a
      critical edge whose source is an IndirectBr instruction and that edge
      needs to be instrumented.
      
      To avoid this in certain cases, split IndirectBr critical edges in the PGO
      gen/use passes. This works for blocks with single indirectbr predecessors,
      but not for those with multiple indirectbr predecessors (splitting an
      IndirectBr critical edge isn't always possible.)
      
      Reviewers: davidxl, xur
      
      Reviewed By: davidxl
      
      Subscribers: efriedma, llvm-commits, mehdi_amini
      
      Differential Revision: https://reviews.llvm.org/D40699
      
      llvm-svn: 320511
      f3bda1da
  14. Dec 10, 2017
  15. Dec 09, 2017
  16. Dec 08, 2017
    • Adrian Prantl's avatar
      Generalize llvm::replaceDbgDeclare and actually support the use-case that · d1317017
      Adrian Prantl authored
      is mentioned in the documentation (inserting a deref before the plus_uconst).
      
      llvm-svn: 320203
      d1317017
    • Florian Hahn's avatar
      [CodeExtractor] Add debug locations for new call and branch instrs. · e5089e2e
      Florian Hahn authored
      Summary:
      If a partially inlined function has debug info, we have to add debug
      locations to the call instruction calling the outlined function.
      We use the debug location of the first instruction in the outlined
      function, as the introduced call transfers control to this statement and
      there is no other equivalent line in the source code.
      
      We also use the same debug location for the branch instruction added
      to jump from artificial entry block for the outlined function, which just
      jumps to the first actual basic block of the outlined function.
      
      Reviewers: davide, aprantl, rriddle, dblaikie, danielcdh, wmi
      
      Reviewed By: aprantl, rriddle, danielcdh
      
      Subscribers: eraman, JDevlieghere, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D40413
      
      llvm-svn: 320199
      e5089e2e
  17. Dec 06, 2017
  18. Dec 05, 2017
    • Mikael Holmen's avatar
      Bail out of a SimplifyCFG switch table opt at undef values. · 0a3e9806
      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: uabelho, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D40639
      
      llvm-svn: 319768
      0a3e9806
  19. Dec 04, 2017
  20. 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
    • 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
    • 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
  21. Nov 28, 2017
  22. Nov 27, 2017
Loading