Skip to content
  1. Jun 27, 2015
    • David Majnemer's avatar
      [PruneEH] A naked, noinline function can return via InlineAsm · 5185c3c2
      David Majnemer authored
      The PruneEH pass tries to annotate functions as 'noreturn' if it doesn't
      see a ReturnInst.  However, a naked function containing inline assembly
      can contain control flow leaving the function.
      
      This fixes PR23971.
      
      llvm-svn: 240876
      5185c3c2
    • Peter Collingbourne's avatar
      LowerBitSets: Ignore bitset entries that do not directly refer to a global. · ba4c8b50
      Peter Collingbourne authored
      It is possible for a global to be substituted with another global of a
      different type or a different kind (i.e. an alias) at IR link time. One
      example of this scenario is when a Microsoft ABI vtable is substituted with
      an alias referring to a larger vtable containing an RTTI reference.
      
      This will cause the global to be RAUW'd with a possibly bitcasted reference
      to the other global. This will of course also affect any references to the
      global in bitset metadata.
      
      The right way to handle such metadata is simply to ignore it. This is sound
      because the linked module should contain another copy of the bitset entries as
      applied to the new global.
      
      llvm-svn: 240866
      ba4c8b50
  2. Jun 25, 2015
  3. Jun 23, 2015
  4. Jun 20, 2015
  5. Jun 19, 2015
  6. Jun 17, 2015
  7. Jun 15, 2015
    • Peter Collingbourne's avatar
      Protection against stack-based memory corruption errors using SafeStack · 82437bf7
      Peter Collingbourne authored
      This patch adds the safe stack instrumentation pass to LLVM, which separates
      the program stack into a safe stack, which stores return addresses, register
      spills, and local variables that are statically verified to be accessed
      in a safe way, and the unsafe stack, which stores everything else. Such
      separation makes it much harder for an attacker to corrupt objects on the
      safe stack, including function pointers stored in spilled registers and
      return addresses. You can find more information about the safe stack, as
      well as other parts of or control-flow hijack protection technique in our
      OSDI paper on code-pointer integrity (http://dslab.epfl.ch/pubs/cpi.pdf)
      and our project website (http://levee.epfl.ch).
      
      The overhead of our implementation of the safe stack is very close to zero
      (0.01% on the Phoronix benchmarks). This is lower than the overhead of
      stack cookies, which are supported by LLVM and are commonly used today,
      yet the security guarantees of the safe stack are strictly stronger than
      stack cookies. In some cases, the safe stack improves performance due to
      better cache locality.
      
      Our current implementation of the safe stack is stable and robust, we
      used it to recompile multiple projects on Linux including Chromium, and
      we also recompiled the entire FreeBSD user-space system and more than 100
      packages. We ran unit tests on the FreeBSD system and many of the packages
      and observed no errors caused by the safe stack. The safe stack is also fully
      binary compatible with non-instrumented code and can be applied to parts of
      a program selectively.
      
      This patch is our implementation of the safe stack on top of LLVM. The
      patches make the following changes:
      
      - Add the safestack function attribute, similar to the ssp, sspstrong and
        sspreq attributes.
      
      - Add the SafeStack instrumentation pass that applies the safe stack to all
        functions that have the safestack attribute. This pass moves all unsafe local
        variables to the unsafe stack with a separate stack pointer, whereas all
        safe variables remain on the regular stack that is managed by LLVM as usual.
      
      - Invoke the pass as the last stage before code generation (at the same time
        the existing cookie-based stack protector pass is invoked).
      
      - Add unit tests for the safe stack.
      
      Original patch by Volodymyr Kuznetsov and others at the Dependable Systems
      Lab at EPFL; updates and upstreaming by myself.
      
      Differential Revision: http://reviews.llvm.org/D6094
      
      llvm-svn: 239761
      82437bf7
  8. Jun 12, 2015
  9. Jun 10, 2015
    • Peter Collingbourne's avatar
      ArgumentPromotion: Drop sret attribute on functions that are only called directly. · 115fe376
      Peter Collingbourne authored
      If the first argument to a function is a 'this' argument and the second
      has the sret attribute, the ArgumentPromotion pass may promote the 'this'
      argument to more than one argument, violating the IR constraint that 'sret'
      may only be applied to the first or second argument.
      
      Although this IR constraint is arguably unnecessary, it highlighted the fact
      that ArgPromotion does not need to preserve this attribute. Dropping the
      attribute reduces register pressure in the backend by avoiding the register
      copy required by sret. Because sret implies noalias, we also replace the
      former with the latter.
      
      Differential Revision: http://reviews.llvm.org/D10353
      
      llvm-svn: 239488
      115fe376
    • Teresa Johnson's avatar
      Add new EliminateAvailableExternally module pass, which is performed in · 232fa9af
      Teresa Johnson authored
      O2 compiles just before GlobalDCE, unless we are preparing for LTO.
      
      This pass eliminates available externally globals (turning them into
      declarations), regardless of whether they are dead/unreferenced, since
      we are guaranteed to have a copy available elsewhere at link time.
      This enables additional opportunities for GlobalDCE.
      
      If we are preparing for LTO (e.g. a -flto -c compile), the pass is not
      included as we want to preserve available externally functions for possible
      link time inlining. The FE indicates whether we are doing an -flto compile
      via the new PrepareForLTO flag on the PassManagerBuilder.
      
      llvm-svn: 239480
      232fa9af
  10. Jun 09, 2015
  11. Jun 04, 2015
    • Chandler Carruth's avatar
      [PM/AA] Start refactoring AliasAnalysis to remove the analysis group and · 70c61c1a
      Chandler Carruth authored
      port it to the new pass manager.
      
      All this does is extract the inner "location" class used by AA into its
      own full fledged type. This seems *much* cleaner as MemoryDependence and
      soon MemorySSA also use this heavily, and it doesn't make much sense
      being inside the AA infrastructure.
      
      This will also make it much easier to break apart the AA infrastructure
      into something that stands on its own rather than using the analysis
      group design.
      
      There are a few places where this makes APIs not make sense -- they were
      taking an AliasAnalysis pointer just to build locations. I'll try to
      clean those up in follow-up commits.
      
      Differential Revision: http://reviews.llvm.org/D10228
      
      llvm-svn: 239003
      70c61c1a
  12. May 29, 2015
    • Benjamin Kramer's avatar
      Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types · f5e2fc47
      Benjamin Kramer authored
      If the type isn't trivially moveable emplace can skip a potentially
      expensive move. It also saves a couple of characters.
      
      
      Call sites were found with the ASTMatcher + some semi-automated cleanup.
      
      memberCallExpr(
          argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
          on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
          hasArgument(0, bindTemporaryExpr(
                             hasType(recordDecl(hasNonTrivialDestructor())),
                             has(constructExpr()))),
          unless(isInTemplateInstantiation()))
      
      No functional change intended.
      
      llvm-svn: 238602
      f5e2fc47
  13. May 28, 2015
  14. May 25, 2015
  15. May 19, 2015
  16. May 15, 2015
    • Jingyue Wu's avatar
      [NFC] remove an extra new line · 25e2500a
      Jingyue Wu authored
      llvm-svn: 237462
      25e2500a
    • Jingyue Wu's avatar
      Add a speculative execution pass · 154eb5aa
      Jingyue Wu authored
      Summary:
      This is a pass for speculative execution of instructions for simple if-then (triangle) control flow. It's aimed at GPUs, but could perhaps be used in other contexts. Enabling this pass gives us a 1.0% geomean improvement on Google benchmark suites, with one benchmark improving 33%.
      
      Credit goes to Jingyue Wu for writing an earlier version of this pass.
      
      Patched by Bjarke Roune. 
      
      Test Plan:
      This patch adds a set of tests in test/Transforms/SpeculativeExecution/spec.ll
      The pass is controlled by a flag which defaults to having the pass not run.
      
      Reviewers: eliben, dberlin, meheff, jingyue, hfinkel
      
      Reviewed By: jingyue, hfinkel
      
      Subscribers: majnemer, jholewinski, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D9360
      
      llvm-svn: 237459
      154eb5aa
    • Wei Mi's avatar
      Add another InstCombine pass after LoopUnroll. · bf727ba3
      Wei Mi authored
      This is to cleanup some redundency generated by LoopUnroll pass. Such redundency may not be cleaned up by existing passes after LoopUnroll.
      
      Differential Revision: http://reviews.llvm.org/D9777
      
      llvm-svn: 237395
      bf727ba3
  17. May 14, 2015
    • Adam Nemet's avatar
      New Loop Distribution pass · 938d3d63
      Adam Nemet authored
      Summary:
      This implements the initial version as was proposed earlier this year
      (http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-January/080462.html).
      Since then Loop Access Analysis was split out from the Loop Vectorizer
      and was made into a separate analysis pass.  Loop Distribution becomes
      the second user of this analysis.
      
      The pass is off by default and can be enabled
      with -enable-loop-distribution.  There is currently no notion of
      profitability; if there is a loop with dependence cycles, the pass will
      try to split them off from other memory operations into a separate loop.
      
      I decided to remove the control-dependence calculation from this first
      version.  This and the issues with the PDT are actively discussed so it
      probably makes sense to treat it separately.  Right now I just mark all
      terminator instruction required which keeps identical CFGs for each
      distributed loop.  This seems to be working pretty well for 456.hmmer
      where even though there is an empty if-then block in the distributed
      loop initially, it gets completely removed.
      
      The pass keeps DominatorTree and LoopInfo updated.  I've tested this
      with -loop-distribute-verify with the testsuite where we distribute ~90
      loops.  SimplifyLoop is violated in some cases and I have a FIXME
      covering this.
      
      Reviewers: hfinkel, nadav, aschwaighofer
      
      Reviewed By: aschwaighofer
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D8831
      
      llvm-svn: 237358
      938d3d63
  18. May 12, 2015
  19. May 07, 2015
  20. May 05, 2015
    • David Majnemer's avatar
      [Inliner] Discard empty COMDAT groups · ac256cfe
      David Majnemer authored
      COMDAT groups which have become rendered unused because of inline are
      discardable if we can prove that we've made the group empty.
      
      This fixes PR22285.
      
      llvm-svn: 236539
      ac256cfe
  21. Apr 29, 2015
    • David Blaikie's avatar
      [opaque pointer type] Pass GlobalAlias the actual pointer type rather than... · f64246be
      David Blaikie authored
      [opaque pointer type] Pass GlobalAlias the actual pointer type rather than decomposing it into pointee type + address space
      
      Many of the callers already have the pointer type anyway, and for the
      couple of callers that don't it's pretty easy to call PointerType::get
      on the pointee type and address space.
      
      This avoids LLParser from using PointerType::getElementType when parsing
      GlobalAliases from IR.
      
      llvm-svn: 236160
      f64246be
    • Duncan P. N. Exon Smith's avatar
      IR: Give 'DI' prefix to debug info metadata · a9308c49
      Duncan P. N. Exon Smith authored
      Finish off PR23080 by renaming the debug info IR constructs from `MD*`
      to `DI*`.  The last of the `DIDescriptor` classes were deleted in
      r235356, and the last of the related typedefs removed in r235413, so
      this has all baked for about a week.
      
      Note: If you have out-of-tree code (like a frontend), I recommend that
      you get everything compiling and tests passing with the *previous*
      commit before updating to this one.  It'll be easier to keep track of
      what code is using the `DIDescriptor` hierarchy and what you've already
      updated, and I think you're extremely unlikely to insert bugs.  YMMV of
      course.
      
      Back to *this* commit: I did this using the rename-md-di-nodes.sh
      upgrade script I've attached to PR23080 (both code and testcases) and
      filtered through clang-format-diff.py.  I edited the tests for
      test/Assembler/invalid-generic-debug-node-*.ll by hand since the columns
      were off-by-three.  It should work on your out-of-tree testcases (and
      code, if you've followed the advice in the previous paragraph).
      
      Some of the tests are in badly named files now (e.g.,
      test/Assembler/invalid-mdcompositetype-missing-tag.ll should be
      'dicompositetype'); I'll come back and move the files in a follow-up
      commit.
      
      llvm-svn: 236120
      a9308c49
  22. Apr 23, 2015
    • Philip Reames's avatar
      Move Value.isDereferenceablePointer to ValueTracking [NFC] · 5461d45a
      Philip Reames authored
      Move isDereferenceablePointer function to Analysis. This function recursively tracks dereferencability over a chain of values like other functions in ValueTracking.
      
      This refactoring is motivated by further changes to support dereferenceable_or_null attribute (http://reviews.llvm.org/D8650). isDereferenceablePointer will be extended to perform context-sensitive analysis and IR is not a good place to have such functionality.
      
      Patch by: Artur Pilipenko <apilipenko@azulsystems.com>
      Differential Revision: reviews.llvm.org/D9075
      
      llvm-svn: 235611
      5461d45a
Loading