Skip to content
  1. Jul 15, 2014
  2. Jul 12, 2014
    • Owen Anderson's avatar
      Fix an issue with the MergeBasicBlockIntoOnlyPred() helper function where it did · a8d1c3e7
      Owen Anderson authored
      not properly handle the case where the predecessor block was the entry block to
      the function.  The only in-tree client of this is JumpThreading, which worked
      around the issue in its own code.  This patch moves the solution into the helper
      so that JumpThreading (and other clients) do not have to replicate the same fix
      everywhere.
      
      llvm-svn: 212875
      a8d1c3e7
  3. Jul 11, 2014
  4. Jul 10, 2014
    • Hal Finkel's avatar
      Feeding isSafeToSpeculativelyExecute its DataLayout pointer · a995f926
      Hal Finkel authored
      isSafeToSpeculativelyExecute can optionally take a DataLayout pointer. In the
      past, this was mainly used to make better decisions regarding divisions known
      not to trap, and so was not all that important for users concerned with "cheap"
      instructions. However, now it also helps look through bitcasts for
      dereferencable loads, and will also be important if/when we add a
      dereferencable pointer attribute.
      
      This is some initial work to feed a DataLayout pointer through to callers of
      isSafeToSpeculativelyExecute, generally where one was already available.
      
      llvm-svn: 212720
      a995f926
  5. Jul 09, 2014
    • Alexey Samsonov's avatar
      Decouple llvm::SpecialCaseList text representation and its LLVM IR semantics. · b7dd329f
      Alexey Samsonov authored
      Turn llvm::SpecialCaseList into a simple class that parses text files in
      a specified format and knows nothing about LLVM IR. Move this class into
      LLVMSupport library. Implement two users of this class:
        * DFSanABIList in DFSan instrumentation pass.
        * SanitizerBlacklist in Clang CodeGen library.
      The latter will be modified to use actual source-level information from frontend
      (source file names) instead of unstable LLVM IR things (LLVM Module identifier).
      
      Remove dependency edge from ClangCodeGen/ClangDriver to LLVMTransformUtils.
      
      No functionality change.
      
      llvm-svn: 212643
      b7dd329f
  6. Jul 08, 2014
  7. Jul 07, 2014
  8. Jul 06, 2014
  9. Jul 03, 2014
  10. Jun 30, 2014
    • David Blaikie's avatar
      DebugInfo: Preserve debug location information when transforming a call into... · 644d2eee
      David Blaikie authored
      DebugInfo: Preserve debug location information when transforming a call into an invoke during inlining.
      
      This both improves basic debug info quality, but also fixes a larger
      hole whenever we inline a call/invoke without a location (debug info for
      the entire inlining is lost and other badness that the debug info
      emission code is currently working around but shouldn't have to).
      
      llvm-svn: 212065
      644d2eee
  11. Jun 27, 2014
  12. Jun 26, 2014
    • Hans Wennborg's avatar
      Don't build switch tables for dllimport and TLS variables in GEPs · b03ebfb7
      Hans Wennborg authored
      This is a follow-up to r211331, which failed to notice that we were
      returning early from ValidLookupTableConstant for GEPs.
      
      llvm-svn: 211753
      b03ebfb7
    • Alp Toker's avatar
      Introduce a string_ostream string builder facilty · 61471738
      Alp Toker authored
      string_ostream is a safe and efficient string builder that combines opaque
      stack storage with a built-in ostream interface.
      
      small_string_ostream<bytes> additionally permits an explicit stack storage size
      other than the default 128 bytes to be provided. Beyond that, storage is
      transferred to the heap.
      
      This convenient class can be used in most places an
      std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair
      would previously have been used, in order to guarantee consistent access
      without byte truncation.
      
      The patch also converts much of LLVM to use the new facility. These changes
      include several probable bug fixes for truncated output, a programming error
      that's no longer possible with the new interface.
      
      llvm-svn: 211749
      61471738
  13. Jun 21, 2014
  14. Jun 20, 2014
  15. Jun 16, 2014
    • Jim Grosbach's avatar
      LowerSwitch: track bounding range for the condition tree. · fff5663d
      Jim Grosbach authored
      When LowerSwitch transforms a switch instruction into a tree of ifs it
      is actually performing a binary search into the various case ranges, to
      see if the current value falls into one cases range of values.
      
      So, if we have a program with something like this:
      
      switch (a) {
      case 0:
        do0();
        break;
      case 1:
        do1();
        break;
      case 2:
        do2();
        break;
      default:
        break;
      }
      
      the code produced is something like this:
      
        if (a < 1) {
          if (a == 0) {
            do0();
          }
        } else {
          if (a < 2) {
            if (a == 1) {
              do1();
            }
          } else {
            if (a == 2) {
              do2();
            }
          }
        }
      
      This code is inefficient because the check (a == 1) to execute do1() is
      not needed.
      
      The reason is that because we already checked that (a >= 1) initially by
      checking that also  (a < 2) we basically already inferred that (a == 1)
      without the need of an extra basic block spawned to check if actually (a
      == 1).
      
      The patch addresses this problem by keeping track of already
      checked bounds in the LowerSwitch algorithm, so that when the time
      arrives to produce a Leaf Block that checks the equality with the case
      value / range the algorithm can decide if that block is really needed
      depending on the already checked bounds .
      
      For example, the above with "a = 1" would work like this:
      
      the bounds start as LB: NONE , UB: NONE
      as (a < 1) is emitted the bounds for the else path become LB: 1 UB:
      NONE. This happens because by failing the test (a < 1) we know that the
      value "a" cannot be smaller than 1 if we enter the else branch.
      After the emitting the check (a < 2) the bounds in the if branch become
      LB: 1 UB: 1. This is because by checking that "a" is smaller than 2 then
      the upper bound becomes 2 - 1 = 1.
      
      When it is time to emit the leaf block for "case 1:" we notice that 1
      can be squeezed exactly in between the LB and UB, which means that if we
      arrived to that block there is no need to emit a block that checks if (a
      == 1).
      
      Patch by: Marcello Maggioni <hayarms@gmail.com>
      
      llvm-svn: 211038
      fff5663d
  16. Jun 13, 2014
  17. Jun 12, 2014
  18. Jun 09, 2014
    • Evgeniy Stepanov's avatar
      Fix line numbers for code inlined from __nodebug__ functions. · 2be29929
      Evgeniy Stepanov authored
      Instructions from __nodebug__ functions don't have file:line
      information even when inlined into no-nodebug functions. As a result,
      intrinsics (SSE and other) from <*intrin.h> clang headers _never_
      have file:line information.
      
      With this change, an instruction without !dbg metadata gets one from
      the call instruction when inlined.
      
      Fixes PR19001.
      
      llvm-svn: 210459
      2be29929
  19. Jun 03, 2014
    • Rafael Espindola's avatar
      Allow alias to point to an arbitrary ConstantExpr. · 64c1e180
      Rafael Espindola authored
      This  patch changes GlobalAlias to point to an arbitrary ConstantExpr and it is
      up to MC (or the system assembler) to decide if that expression is valid or not.
      
      This reduces our ability to diagnose invalid uses and how early we can spot
      them, but it also lets us do things like
      
      @test5 = alias inttoptr(i32 sub (i32 ptrtoint (i32* @test2 to i32),
                                       i32 ptrtoint (i32* @bar to i32)) to i32*)
      
      An important implication of this patch is that the notion of aliased global
      doesn't exist any more. The alias has to encode the information needed to
      access it in its metadata (linkage, visibility, type, etc).
      
      Another consequence to notice is that getSection has to return a "const char *".
      It could return a NullTerminatedStringRef if there was such a thing, but when
      that was proposed the decision was to just uses "const char*" for that.
      
      llvm-svn: 210062
      64c1e180
  20. May 30, 2014
  21. May 29, 2014
  22. May 22, 2014
    • Diego Novillo's avatar
      Add support for missed and analysis optimization remarks. · 7f8af8bf
      Diego Novillo authored
      Summary:
      This adds two new diagnostics: -pass-remarks-missed and
      -pass-remarks-analysis. They take the same values as -pass-remarks but
      are intended to be triggered in different contexts.
      
      -pass-remarks-missed is used by LLVMContext::emitOptimizationRemarkMissed,
      which passes call when they tried to apply a transformation but
      couldn't.
      
      -pass-remarks-analysis is used by LLVMContext::emitOptimizationRemarkAnalysis,
      which passes call when they want to inform the user about analysis
      results.
      
      The patch also:
      
      1- Adds support in the inliner for the two new remarks and a
         test case.
      
      2- Moves emitOptimizationRemark* functions to the llvm namespace.
      
      3- Adds an LLVMContext argument instead of making them member functions
         of LLVMContext.
      
      Reviewers: qcolombet
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D3682
      
      llvm-svn: 209442
      7f8af8bf
  23. May 19, 2014
  24. May 17, 2014
  25. May 16, 2014
    • Reid Kleckner's avatar
      Add comdat key field to llvm.global_ctors and llvm.global_dtors · fceb76f5
      Reid Kleckner authored
      This allows us to put dynamic initializers for weak data into the same
      comdat group as the data being initialized.  This is necessary for MSVC
      ABI compatibility.  Once we have comdats for guard variables, we can use
      the combination to help GlobalOpt fire more often for weak data with
      guarded initialization on other platforms.
      
      Reviewers: nlewycky
      
      Differential Revision: http://reviews.llvm.org/D3499
      
      llvm-svn: 209015
      fceb76f5
    • Rafael Espindola's avatar
      Fix most of PR10367. · 6b238633
      Rafael Espindola authored
      This patch changes the design of GlobalAlias so that it doesn't take a
      ConstantExpr anymore. It now points directly to a GlobalObject, but its type is
      independent of the aliasee type.
      
      To avoid changing all alias related tests in this patches, I kept the common
      syntax
      
      @foo = alias i32* @bar
      
      to mean the same as now. The cases that used to use cast now use the more
      general syntax
      
      @foo = alias i16, i32* @bar.
      
      Note that GlobalAlias now behaves a bit more like GlobalVariable. We
      know that its type is always a pointer, so we omit the '*'.
      
      For the bitcode, a nice surprise is that we were writing both identical types
      already, so the format change is minimal. Auto upgrade is handled by looking
      through the casts and no new fields are needed for now. New bitcode will
      simply have different types for Alias and Aliasee.
      
      One last interesting point in the patch is that replaceAllUsesWith becomes
      smart enough to avoid putting a ConstantExpr in the aliasee. This seems better
      than checking and updating every caller.
      
      A followup patch will delete getAliasedGlobal now that it is redundant. Another
      patch will add support for an explicit offset.
      
      llvm-svn: 209007
      6b238633
    • Rafael Espindola's avatar
      Change the GlobalAlias constructor to look a bit more like GlobalVariable. · 4fe0094f
      Rafael Espindola authored
      This is part of the fix for pr10367. A GlobalAlias always has a pointer type,
      so just have the constructor build the type.
      
      llvm-svn: 208983
      4fe0094f
  26. May 15, 2014
  27. May 14, 2014
  28. May 13, 2014
    • Rafael Espindola's avatar
      Split GlobalValue into GlobalValue and GlobalObject. · 99e05cf1
      Rafael Espindola authored
      This allows code to statically accept a Function or a GlobalVariable, but
      not an alias. This is already a cleanup by itself IMHO, but the main
      reason for it is that it gives a lot more confidence that the refactoring to fix
      the design of GlobalAlias is correct. That will be a followup patch.
      
      llvm-svn: 208716
      99e05cf1
  29. May 09, 2014
    • Louis Gerbarg's avatar
      Add ExtractValue instruction to SimplifyCFG's ComputeSpeculationCost · 1f54b821
      Louis Gerbarg authored
      Since ExtractValue is not included in ComputeSpeculationCost CFGs containing
      ExtractValueInsts cannot be simplified. In particular this interacts with
      InstCombineCompare's tendency to insert add.with.overflow intrinsics for
      certain idiomatic math operations, preventing optimization.
      
      This patch adds ExtractValue to the ComputeSpeculationCost. Test case included
      
      rdar://14853450
      
      llvm-svn: 208434
      1f54b821
Loading