Skip to content
  1. Sep 28, 2015
    • Sean Silva's avatar
      [GlobalOpt] Sort members of llvm.used deterministically · ace7818c
      Sean Silva authored
      Patch by Jake VanAdrighem!
      
      Summary:
      Fix the way we sort the llvm.used and llvm.compiler.used members.
      
      This bug seems to have been introduced in rL183756 through a set of improper casts to GlobalValue*. In subsequent patches this problem was missed and transformed into a getName call on a ConstantExpr.
      
      Reviewers: silvas
      
      Subscribers: silvas, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D12851
      
      llvm-svn: 248728
      ace7818c
    • Fiona Glaser's avatar
      Improve performance of SimplifyInstructionsInBlock · f74cc40e
      Fiona Glaser authored
      1. Use a worklist, not a recursive approach, to avoid needless
         revisitation and being repeatedly forced to jump back to the
         start of the BB if a handle is invalidated.
      
      2. Only insert operands to the worklist if they become unused
         after a dead instruction is removed, so we don’t have to
         visit them again in most cases.
      
      3. Use a SmallSetVector to track the worklist.
      
      4. Instead of pre-initting the SmallSetVector like in
         DeadCodeEliminationPass, only put things into the worklist
         if they have to be revisited after the first run-through.
         This minimizes how much the actual SmallSetVector gets used,
         which saves a lot of time.
      
      llvm-svn: 248727
      f74cc40e
    • Weiming Zhao's avatar
      [LoopReroll] Ignore debug intrinsics · 310770a9
      Weiming Zhao authored
      Originally, debug intrinsics and annotation intrinsics may prevent
      the loop to be rerolled, now they are ignored.
      
      Differential Revision: http://reviews.llvm.org/D13150
      
      llvm-svn: 248718
      310770a9
  2. Sep 27, 2015
    • Sanjay Patel's avatar
      [InstCombine] fold zexts and constants into a phi (PR24766) · 95334075
      Sanjay Patel authored
      This is one step towards solving PR24766:
      https://llvm.org/bugs/show_bug.cgi?id=24766
      
      We were not producing the same IR for these two C functions because the store
      to the temp bool causes extra zexts:
      
      #include <stdbool.h>
      
      bool switchy(char x1, char x2, char condition) {
         bool conditionMet = false;
         switch (condition) {
         case 0: conditionMet = (x1 == x2); break;
         case 1: conditionMet = (x1 <= x2); break;
         }
         return conditionMet;
      }
      
      bool switchy2(char x1, char x2, char condition) {
         switch (condition) {
         case 0: return (x1 == x2);
         case 1: return (x1 <= x2);
         }
        return false;
      }
      
      As noted in the code comments, this test case manages to avoid the more general existing
      phi optimizations where there are only 2 phi inputs or where there are no constant phi 
      args mixed in with the casts ops. It seems like a corner case, but if we don't catch it, 
      then I don't think we can get SimplifyCFG to further optimize towards the canonical form
      for this function shown in the bug report.
      
      Differential Revision: http://reviews.llvm.org/D12866
      
      llvm-svn: 248689
      95334075
    • Joseph Tremoulet's avatar
      [EH] Create removeUnwindEdge utility · 09af67ab
      Joseph Tremoulet authored
      Summary:
      Factor the code that rewrites invokes to calls and rewrites WinEH
      terminators to their "unwind to caller" equivalents into a helper in
      Utils/Local, and use it in the three places I'm aware of that need to do
      this.
      
      
      Reviewers: andrew.w.kaylor, majnemer, rnk
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D13152
      
      llvm-svn: 248677
      09af67ab
  3. Sep 26, 2015
    • Sanjay Patel's avatar
      [InstCombine] match De Morgan's Law hidden by zext ops (PR22723) · e1b09caa
      Sanjay Patel authored
      This is a fix for PR22723:
      https://llvm.org/bugs/show_bug.cgi?id=22723
      
      My first attempt at this was to change what I thought was the root problem:
      
      xor (zext i1 X to i32), 1 --> zext (xor i1 X, true) to i32
      
      ...but we create the opposite pattern in InstCombiner::visitZExt(), so infinite loop!
      
      My next idea was to fix the matchIfNot() implementation in PatternMatch, but that would
      mean potentially returning a different size for the match than what was input. I think
      this would require all users of m_Not to check the size of the returned match, so I 
      abandoned that idea.
      
      I settled on just fixing the exact case presented in the PR. This patch does allow the
      2 functions in PR22723 to compile identically (x86):
      
      bool test(bool x, bool y) { return !x | !y; }
      bool test(bool x, bool y) { return !x || !y; }
      ...
      andb	%sil, %dil
      xorb	$1, %dil
      movb	%dil, %al
      retq
      
      Differential Revision: http://reviews.llvm.org/D12705
      
      llvm-svn: 248634
      e1b09caa
  4. Sep 25, 2015
  5. Sep 24, 2015
  6. Sep 23, 2015
    • Lawrence Hu's avatar
      · cac0b892
      Lawrence Hu authored
          Swap loop invariant GEP with loop variant GEP to allow more LICM.
      
          This patch changes the order of GEPs generated by Splitting GEPs
          pass, specially when one of the GEPs has constant and the base is
          loop invariant, then we will generate the GEP with constant first
          when beneficial, to expose more cases for LICM.
      
          If originally Splitting GEP generate the following:
            do.body.i:
              %idxprom.i = sext i32 %shr.i to i64
              %2 = bitcast %typeD* %s to i8*
              %3 = shl i64 %idxprom.i, 2
              %uglygep = getelementptr i8, i8* %2, i64 %3
              %uglygep7 = getelementptr i8, i8* %uglygep, i64 1032
            ...
          Now it genereates:
            do.body.i:
              %idxprom.i = sext i32 %shr.i to i64
              %2 = bitcast %typeD* %s to i8*
              %3 = shl i64 %idxprom.i, 2
              %uglygep = getelementptr i8, i8* %2, i64 1032
              %uglygep7 = getelementptr i8, i8* %uglygep, i64 %3
            ...
      
          For no-loop cases, the original way of generating GEPs seems to
          expose more CSE cases, so we don't change the logic for no-loop
          cases, and only limit our change to the specific case we are
          interested in.
      
      llvm-svn: 248420
      cac0b892
    • Akira Hatanaka's avatar
      [InstCombine] Preserve metadata when merging loads that are phi · f6afd115
      Akira Hatanaka authored
      arguments.
      
      Make sure InstCombiner::FoldPHIArgLoadIntoPHI doesn't drop the following
      metadata:
      
      MD_tbaa
      MD_alias_scope
      MD_noalias
      MD_invariant_load
      MD_nonnull
      MD_range
      
      rdar://problem/17617709
      
      Differential Revision: http://reviews.llvm.org/D12710
      
      llvm-svn: 248419
      f6afd115
    • Evgeniy Stepanov's avatar
      Android support for SafeStack. · a2002b08
      Evgeniy Stepanov authored
      Add two new ways of accessing the unsafe stack pointer:
      
      * At a fixed offset from the thread TLS base. This is very similar to
        StackProtector cookies, but we plan to extend it to other backends
        (ARM in particular) soon. Bionic-side implementation here:
        https://android-review.googlesource.com/170988.
      * Via a function call, as a fallback for platforms that provide
        neither a fixed TLS slot, nor a reasonable TLS implementation (i.e.
        not emutls).
      
      This is a re-commit of a change in r248357 that was reverted in
      r248358.
      
      llvm-svn: 248405
      a2002b08
    • Vedant Kumar's avatar
      [Inline] Use AssumptionCache from the right Function · ff08e926
      Vedant Kumar authored
      This changes the behavior of AddAligntmentAssumptions to match its
      comment. I.e, prove the asserted alignment in the context of the caller,
      not the callee.
      
      Thanks to Mehdi Amini for seeing the issue here! Also to Artur Pilipenko
      who also saw a fix for the issue.
      
      rdar://22521387
      
      Differential Revision: http://reviews.llvm.org/D12997
      
      llvm-svn: 248390
      ff08e926
    • David Majnemer's avatar
      [DeadArgElim] Split the invoke successor edge · fa36bde2
      David Majnemer authored
      Invoking a function which returns an aggregate can sometimes be
      transformed to return a scalar value.  However, this means that we need
      to create an insertvalue instruction(s) to recreate the correct
      aggregate type.  We achieved this by inserting an insertvalue
      instruction at the invoke's normal successor.  However, this is not
      feasible if the normal successor uses the invoke's return value inside a
      PHI node.
      
      Instead, split the edge between the invoke and the unwind successor and
      create the insertvalue instruction in the new basic block.  The new
      basic block's successor will be the old invoke successor which leaves
      us with IR which is well behaved.
      
      This fixes PR24906.
      
      llvm-svn: 248387
      fa36bde2
    • Igor Laevsky's avatar
      [DeadStoreElimination] Remove dead zero store to calloc initialized memory · 029bd93c
      Igor Laevsky authored
      This change allows dead store elimination to remove zero and null stores into memory freshly allocated with calloc-like function.
      
      Differential Revision: http://reviews.llvm.org/D13021
      
      llvm-svn: 248374
      029bd93c
    • Simon Pilgrim's avatar
      [X86][SSE] Replace 128-bit SSE41 PMOVSX intrinsics with native IR · 9cb018b6
      Simon Pilgrim authored
      This patches removes the x86.sse41.pmovsx* intrinsics, provides a suitable upgrade path and updates relevant tests to sign extend a subvector instead.
      
      LLVM counterpart to D12835
      
      Differential Revision: http://reviews.llvm.org/D13002
      
      llvm-svn: 248368
      9cb018b6
    • Sanjoy Das's avatar
      [SCEV] Introduce ScalarEvolution::getOne and getZero. · 2aacc0ec
      Sanjoy Das authored
      Summary:
      It is fairly common to call SE->getConstant(Ty, 0) or
      SE->getConstant(Ty, 1); this change makes such uses a little bit
      briefer.
      
      I've refactored the call sites I could find easily to use getZero /
      getOne.
      
      Reviewers: hfinkel, majnemer, reames
      
      Subscribers: sanjoy, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D12947
      
      llvm-svn: 248362
      2aacc0ec
    • Evgeniy Stepanov's avatar
      Revert "Android support for SafeStack." · 8d0e3011
      Evgeniy Stepanov authored
      test/Transforms/SafeStack/abi.ll breaks when target is not supported;
      needs refactoring.
      
      llvm-svn: 248358
      8d0e3011
    • Evgeniy Stepanov's avatar
      Android support for SafeStack. · ce2e16f0
      Evgeniy Stepanov authored
      Add two new ways of accessing the unsafe stack pointer:
      
      * At a fixed offset from the thread TLS base. This is very similar to
        StackProtector cookies, but we plan to extend it to other backends
        (ARM in particular) soon. Bionic-side implementation here:
        https://android-review.googlesource.com/170988.
      * Via a function call, as a fallback for platforms that provide
        neither a fixed TLS slot, nor a reasonable TLS implementation (i.e.
        not emutls).
      
      llvm-svn: 248357
      ce2e16f0
    • Michael Zolotukhin's avatar
      deade196
  7. Sep 22, 2015
  8. Sep 21, 2015
  9. Sep 20, 2015
Loading