Skip to content
  1. Aug 04, 2015
    • Simon Pilgrim's avatar
      [InstCombine] Moved SSE vector shift constant folding into its own helper function. NFCI. · dcfd7a3f
      Simon Pilgrim authored
      This will make some upcoming bugfixes + improvements easier to manage.
      
      llvm-svn: 243962
      dcfd7a3f
    • Duncan P. N. Exon Smith's avatar
      Linker: Fix references to uniqued nodes after r243883 · 706f37e8
      Duncan P. N. Exon Smith authored
      r243883 started moving 'distinct' nodes instead of duplicated them in
      lib/Linker.  This had the side-effect of sometimes not cloning uniqued
      nodes that reference them.  I missed a corner case:
      
          !named = !{!0}
          !0 = !{!1}
          !1 = distinct !{!0}
      
      !0 is the entry point for "remapping", and a temporary clone (say,
      !0-temp) is created and mapped in case we need to model a uniquing
      cycle.
      
          Recursive descent into !1.  !1 is distinct, so we leave it alone,
          but update its operand to !0-temp.
      
      Pop back out to !0.  Its only operand, !1, hasn't changed, so we don't
      need to use !0-temp.  !0-temp goes out of scope, and we're finished
      remapping, but we're left with:
      
          !named = !{!0}
          !0 = !{!1}
          !1 = distinct !{null} ; uh oh...
      
      Previously, if !0 and !0-temp ended up with identical operands, then
      !0-temp couldn't have been referenced at all.  Now that distinct nodes
      don't get duplicated, that assumption is invalid.  We need to
      !0-temp->replaceAllUsesWith(!0) before freeing !0-temp.
      
      I found this while running an internal `-flto -g` bootstrap.  Strangely,
      there was no case of this in the open source bootstrap I'd done before
      commit...
      
      llvm-svn: 243961
      706f37e8
    • Sanjoy Das's avatar
      Revert "[LSR] Generate and use zero extends" · 215df9ed
      Sanjoy Das authored
      This reverts commit r243348 and r243357.  They caused PR24347.
      
      llvm-svn: 243939
      215df9ed
    • Adam Nemet's avatar
      [LoopVer] Remove unused needsRuntimeChecks(), NFC · 6b6082dc
      Adam Nemet authored
      The previous commits moved this functionality into the client.
      
      Also remove the now unused member variable.
      
      llvm-svn: 243920
      6b6082dc
  2. Aug 03, 2015
    • Chandler Carruth's avatar
      [Unroll] Improve the brute force loop unroll estimate by propagating · 87adb7a2
      Chandler Carruth authored
      through PHI nodes across iterations.
      
      This patch teaches the new advanced loop unrolling heuristics to propagate
      constants into the loop from the preheader and around the backedge after
      simulating each iteration. This lets us brute force solve simple recurrances
      that aren't modeled effectively by SCEV. It also makes it more clear why we
      need to process the loop in-order rather than bottom-up which might otherwise
      make much more sense (for example, for DCE).
      
      This came out of an attempt I'm making to develop a principled way to account
      for dead code in the unroll estimation. When I implemented
      a forward-propagating version of that it produced incorrect results due to
      failing to propagate *cost* between loop iterations through the PHI nodes, and
      it occured to me we really should at least propagate simplifications across
      those edges, and it is quite easy thanks to the loop being in canonical and
      LCSSA form.
      
      Differential Revision: http://reviews.llvm.org/D11706
      
      llvm-svn: 243900
      87adb7a2
    • Duncan P. N. Exon Smith's avatar
      Linker: Move distinct MDNodes instead of cloning · 4fb46cb8
      Duncan P. N. Exon Smith authored
      Instead of cloning distinct `MDNode`s when linking in a module, just
      move them over.  The module linker destroys the source module, so the
      old node would otherwise just be leaked on the context.  Create the new
      node in place.  This also reduces the number of cloned uniqued nodes
      (since it's less likely their operands have changed).
      
      This mapping strategy is only correct when we're discarding the source,
      so the linker turns it on via a ValueMapper flag, `RF_MoveDistinctMDs`.
      
      There's nothing observable in terms of `llvm-link` output here: the
      linked module should be semantically identical.
      
      I'll be adding more 'distinct' nodes to the debug info metadata graph in
      order to break uniquing cycles, so the benefits of this will partly come
      in future commits.  However, we should get some gains immediately, since
      we have a fair number of 'distinct' `DILocation`s being linked in.
      
      llvm-svn: 243883
      4fb46cb8
    • Duncan P. N. Exon Smith's avatar
      ValueMapper: Only check for cycles if operands change · 50f8969e
      Duncan P. N. Exon Smith authored
      This is a minor optimization to only check for unresolved operands
      inside `mapDistinctNode()` if the operands have actually changed.  This
      shouldn't really cause any change in behaviour.  I didn't actually see a
      slowdown in a profile, I was just poking around nearby and saw the
      opportunity.
      
      llvm-svn: 243866
      50f8969e
    • Duncan P. N. Exon Smith's avatar
      ValueMapper: Use a range-based for, NFC · e08bcbff
      Duncan P. N. Exon Smith authored
      llvm-svn: 243865
      e08bcbff
    • Duncan P. N. Exon Smith's avatar
      ValueMapper: Reuse local variable, NFC · 0880014d
      Duncan P. N. Exon Smith authored
      llvm-svn: 243864
      0880014d
  3. Aug 02, 2015
  4. Jul 31, 2015
  5. Jul 30, 2015
    • Adhemerval Zanella's avatar
      Enable dfsan for aarch64 · bfe1eaf0
      Adhemerval Zanella authored
      This patch enable DFSan memory transformation for aarch64 (39-bit VMA).
      
      llvm-svn: 243684
      bfe1eaf0
    • Wei Mi's avatar
      [SLP vectorizer]: Choose the best consecutive candidate to pair with a store instruction. · d6f7252e
      Wei Mi authored
      The patch changes the SLPVectorizer::vectorizeStores to choose the immediate
      succeeding or preceding candidate for a store instruction when it has multiple
      consecutive candidates. In this way it has better chance to find more slp
      vectorization opportunities.
      
      Differential Revision: http://reviews.llvm.org/D10445
      
      llvm-svn: 243666
      d6f7252e
    • Adam Nemet's avatar
      [LoopVer] Add missing std::move · 252d529b
      Adam Nemet authored
      The reason I was passing this vector by value in the constructor so that
      I wouldn't have to copy when initializing the corresponding member but
      then I forgot the std::move.
      
      The use-case is LoopDistribution which filters the checks then
      std::moves it to LoopVersioning's constructor.  With this interface we
      can avoid any copies.
      
      llvm-svn: 243616
      252d529b
    • Adam Nemet's avatar
      [LDist] Filter the checks locally rather than in LAA, NFC · c75ad69c
      Adam Nemet authored
      Before, we were passing the pointer partitions to LAA.  Now, we get all
      the checks from LAA and filter out the checks within partitions in
      LoopDistribution.
      
      This effectively concludes the steps to move filtering memchecks from
      LAA into its clients.  There is still some cleanup left to remove the
      unused interfaces in LAA that still take PtrPartition.
      
      (Moving this functionality to LoopDistribution also requires
      needsChecking on pointers to be made public.)
      
      llvm-svn: 243613
      c75ad69c
    • Nick Lewycky's avatar
      Fix typo "fuction" noticed in comments in AssumptionCache.h, and also all the... · c3890d29
      Nick Lewycky authored
      Fix typo "fuction" noticed in comments in AssumptionCache.h, and also all the other files that have the same typo. All comments, no functionality change! (Merely a "fuctionality" change.)
      
      Bonus change to remove emacs major mode marker from SystemZMachineFunctionInfo.cpp because emacs already knows it's C++ from the extension. Also fix typo "appeary" in AMDGPUMCAsmInfo.h.
      
      llvm-svn: 243585
      c3890d29
  6. Jul 29, 2015
    • Alexey Samsonov's avatar
      [ASan] Disable dynamic alloca and UAR detection in presence of returns_twice calls. · 869a5ff3
      Alexey Samsonov authored
      Summary:
      returns_twice (most importantly, setjmp) functions are
      optimization-hostile: if local variable is promoted to register, and is
      changed between setjmp() and longjmp() calls, this update will be
      undone. This is the reason why "man setjmp" advises to mark all these
      locals as "volatile".
      
      This can not be enough for ASan, though: when it replaces static alloca
      with dynamic one, optionally called if UAR mode is enabled, it adds a
      whole lot of SSA values, and computations of local variable addresses,
      that can involve virtual registers, and cause unexpected behavior, when
      these registers are restored from buffer saved in setjmp.
      
      To fix this, just disable dynamic alloca and UAR tricks whenever we see
      a returns_twice call in the function.
      
      Reviewers: rnk
      
      Subscribers: llvm-commits, kcc
      
      Differential Revision: http://reviews.llvm.org/D11495
      
      llvm-svn: 243561
      869a5ff3
    • Evgeniy Stepanov's avatar
      [asan] Remove special case mapping on Android/AArch64. · 4d81f86d
      Evgeniy Stepanov authored
      ASan shadow on Android starts at address 0 for both historic and
      performance reasons. This is possible because the platform mandates
      -pie, which makes lower memory region always available.
      
      This is not such a good idea on 64-bit platforms because of MAP_32BIT
      incompatibility.
      
      This patch changes Android/AArch64 mapping to be the same as that of
      Linux/AAarch64.
      
      llvm-svn: 243548
      4d81f86d
    • Peter Collingbourne's avatar
      LowerBitSets: Add debugging output. · 3eddf499
      Peter Collingbourne authored
      Differential Revision: http://reviews.llvm.org/D11583
      
      llvm-svn: 243546
      3eddf499
    • Michael Zolotukhin's avatar
      [Unroll] Handle SwitchInst properly. · 9f06ef76
      Michael Zolotukhin authored
      Previously successor selection was simply wrong.
      
      llvm-svn: 243545
      9f06ef76
    • Michael Zolotukhin's avatar
      [Unroll] Don't crash when simplified branch condition is undef. · 3a7d55b6
      Michael Zolotukhin authored
      llvm-svn: 243544
      3a7d55b6
    • Sanjoy Das's avatar
      [Statepoints] Let patchable statepoints have a symbolic call target. · cfe41f05
      Sanjoy Das authored
      Summary:
      As added initially, statepoints required their call targets to be a
      constant pointer null if ``numPatchBytes`` was non-zero.  This turns out
      to be a problem ergonomically, since there is no way to mark patchable
      statepoints as calling a (readable) symbolic value.
      
      This change remove the restriction of requiring ``null`` call targets
      for patchable statepoints, and changes PlaceSafepoints to maintain the
      symbolic call target through its transformation.
      
      Reviewers: reames, swaroop.sridhar
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D11550
      
      llvm-svn: 243502
      cfe41f05
  7. Jul 28, 2015
  8. Jul 27, 2015
    • Sanjoy Das's avatar
      [IndVars] Make loop varying predicates loop invariant. · 5dab205c
      Sanjoy Das authored
      Summary:
      Was D9784: "Remove loop variant range check when induction variable is
      strictly increasing"
      
      This change re-implements D9784 with the two differences:
      
       1. It does not use SCEVExpander and does not generate new
          instructions.  Instead, it does a quick local search for existing
          `llvm::Value`s that it needs when modifying the `icmp`
          instruction.
      
       2. It is more general -- it deals with both increasing and decreasing
          induction variables.
      
      I've added all of the tests included with D9784, and two more.
      
      As an example on what this change does (copied from D9784):
      
      Given C code:
      
      ```
      for (int i = M; i < N; i++) // i is known not to overflow
        if (i < 0) break;
        a[i] = 0;
      }
      ```
      
      This transformation produces:
      
      ```
      for (int i = M; i < N; i++)
        if (M < 0) break;
        a[i] = 0;
      }
      ```
      
      Which can be unswitched into:
      
      ```
      if (!(M < 0))
        for (int i = M; i < N; i++)
          a[i] = 0;
      }
      ```
      
      I went back and forth on whether the top level logic should live in
      `SimplifyIndvar::eliminateIVComparison` or be put into its own
      routine.  Right now I've put it under `eliminateIVComparison` because
      even though the `icmp` is not *eliminated*, it no longer is an IV
      comparison.  I'm open to putting it in its own helper routine if you
      think that is better.
      
      Reviewers: reames, nicholas, atrick
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D11278
      
      llvm-svn: 243331
      5dab205c
    • Simon Pilgrim's avatar
      Fixed signed/unsigned comparison warning. · 074c0d97
      Simon Pilgrim authored
      llvm-svn: 243306
      074c0d97
    • Simon Pilgrim's avatar
      [InstCombine][X86][SSE] Replace sign/zero extension intrinsics with native IR · 15c0a594
      Simon Pilgrim authored
      Now that we are generating sane codegen for vector sext/zext nodes on SSE targets, this patch uses instcombine to replace the SSE41/AVX2 pmovsx and pmovzx intrinsics with the equivalent native IR code.
      
      Differential Revision: http://reviews.llvm.org/D11503
      
      llvm-svn: 243303
      15c0a594
    • Pete Cooper's avatar
      Revert "Remove unnecessary null check. NFC." · 11bd958c
      Pete Cooper authored
      This reverts commit r243167.
      
      Duncan pointed out that dyn_cast can return null in these cases, so this
      was an unsafe commit to make.  Sorry for the noise.
      
      Worryingly there were no tests which fail...
      
      llvm-svn: 243302
      11bd958c
  9. Jul 26, 2015
    • Jingyue Wu's avatar
      Roll forward r243250 · bfefff55
      Jingyue Wu authored
      r243250 appeared to break clang/test/Analysis/dead-store.c on one of the build
      slaves, but I couldn't reproduce this failure locally. Probably a false
      positive as I saw this test was broken by r243246 or r243247 too but passed
      later without people fixing anything.
      
      llvm-svn: 243253
      bfefff55
    • Jingyue Wu's avatar
      Revert r243250 · 84879b71
      Jingyue Wu authored
      breaks tests
      
      llvm-svn: 243251
      84879b71
    • Jingyue Wu's avatar
      [TTI/CostModel] improve TTI::getGEPCost and use it in CostModel::getInstructionCost · bf485f05
      Jingyue Wu authored
      Summary:
      This patch updates TargetTransformInfoImplCRTPBase::getGEPCost to consider
      addressing modes. It now returns TCC_Free when the GEP can be completely folded
      to an addresing mode.
      
      I started this patch as I refactored SLSR. Function isGEPFoldable looks common
      and is indeed used by some WIP of mine. So I extracted that logic to getGEPCost.
      
      Furthermore, I noticed getGEPCost wasn't directly tested anywhere. The best
      testing bed seems CostModel, but its getInstructionCost method invokes
      getAddressComputationCost for GEPs which provides very coarse estimation. So
      this patch also makes getInstructionCost call the updated getGEPCost for GEPs.
      This change inevitably breaks some tests because the cost model changes, but
      nothing looks seriously wrong -- if we believe the new cost model is the right
      way to go, these tests should be updated.
      
      This patch is not perfect yet -- the comments in some tests need to be updated.
      I want to know whether this is a right approach before fixing those details.
      
      Reviewers: chandlerc, hfinkel
      
      Subscribers: aschwaighofer, llvm-commits, aemerson
      
      Differential Revision: http://reviews.llvm.org/D9819
      
      llvm-svn: 243250
      bf485f05
  10. Jul 25, 2015
    • Simon Pilgrim's avatar
      [InstCombine][SSE4A] Standardized references to Length/Width and Index/Start... · 54fcd62c
      Simon Pilgrim authored
      [InstCombine][SSE4A] Standardized references to Length/Width and Index/Start to match AMD docs. NFCI.
      
      llvm-svn: 243226
      54fcd62c
    • Chen Li's avatar
      [LoopUnswitch] Improve loop unswitch pass to find trivial unswitch conditions more effectively · 145c2f57
      Chen Li authored
      Summary:
      This patch improves trivial loop unswitch. 
      
      The current trivial loop unswitch only checks if loop header's terminator contains a trivial unswitch condition. But if the loop header only has one reachable successor (due to intentionally or unintentionally missed code simplification), we should consider the successor as part of the loop header. Therefore, instead of stopping at loop header's terminator, we should keep traversing its successors within loop until reach a *real* conditional branch or switch (whose condition can not be constant folded). This change will enable a single -loop-unswitch pass to unswitch multiple trivial conditions (unswitch one trivial condition could open opportunity to unswitch another one in the same loop), while the old implementation can unswitch only one per pass. 
      
      Reviewers: reames, broune
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D11481
      
      llvm-svn: 243203
      145c2f57
    • Lawrence Hu's avatar
      Handle loop with negtive induction variable increment · dc8a83b5
      Lawrence Hu authored
      This patch extend LoopReroll pass to hand the loops which
      is similar to the following:
      
            while (len > 1) {
                  sum4 += buf[len];
                  sum4 += buf[len-1];
                  len -= 2;
              }
      
      llvm-svn: 243171
      dc8a83b5
  11. Jul 24, 2015
Loading