1. Aug 16, 2014
    • Chandler Carruth's avatar
      [x86] Teach lots of the new vector shuffle lowering to use UNPCK · e020f117
      Chandler Carruth authored
      instructions for blend operations at 128 bits. This was a serious hole
      in our prior blend lowering.
      
      llvm-svn: 215819
      e020f117
    • David Majnemer's avatar
      InstCombine: Fix a potential bug in 0 - (X sdiv C) -> (X sdiv -C) · 1a0bbc8a
      David Majnemer authored
      While *most* (X sdiv 1) operations will get caught by InstSimplify, it
      is still possible for a sdiv to appear in the worklist which hasn't been
      simplified yet.
      
      This means that it is possible for 0 - (X sdiv 1) to get transformed
      into (X sdiv -1); dividing by -1 can make the transform produce undef
      values instead of the proper result.
      
      Sorry for the lack of testcase, it's a bit problematic because it relies
      on the exact order of operations in the worklist.
      
      llvm-svn: 215818
      1a0bbc8a
    • Tobias Grosser's avatar
      Revert "[Refactor] Cleanup runtime code generation" · 28735947
      Tobias Grosser authored
      This reverts commit 215466 (and 215528, a trivial formatting fix).
      
      The intention of these commits is a good one, but unfortunately they broke
      our LNT buildbot:
      
      http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3-polly-codegen-isl
      
      Several of the cleanup changes that have been combined in this 'fixup' are
      trivial and could probably be committed as obvious changes without risking to
      break the build. The remaining changes are little and it should be easy to
      figure out what went wrong.
      
      llvm-svn: 215817
      28735947
    • Tobias Grosser's avatar
      Revert "Added support for modulo expressions" · f4daf344
      Tobias Grosser authored
      This reverts commit 215684. The intention of the commit is great, but
      unfortunately it seems to be the cause of 14 LNT test suite failures:
      
      http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3-polly/builds/116
      
      To make our buildbots and performance testers green until this issue is solved,
      we temporarily revert this commit.
      
      llvm-svn: 215816
      f4daf344
    • David Majnemer's avatar
      InstCombine: Combine mul with div. · f9a095d6
      David Majnemer authored
      We can combne a mul with a div if one of the operands is a multiple of
      the other:
      
      %mul = mul nsw nuw %a, C1
      %ret = udiv %mul, C2
        =>
      %ret = mul nsw %a, (C1 / C2)
      
      This can expose further optimization opportunities if we end up
      multiplying or dividing by a power of 2.
      
      Consider this small example:
      
      define i32 @f(i32 %a) {
        %mul = mul nuw i32 %a, 14
        %div = udiv exact i32 %mul, 7
        ret i32 %div
      }
      
      which gets CodeGen'd to:
      
          imull       $14, %edi, %eax
          imulq       $613566757, %rax, %rcx
          shrq        $32, %rcx
          subl        %ecx, %eax
          shrl        %eax
          addl        %ecx, %eax
          shrl        $2, %eax
          retq
      
      We can now transform this into:
      define i32 @f(i32 %a) {
        %shl = shl nuw i32 %a, 1
        ret i32 %shl
      }
      
      which gets CodeGen'd to:
      
          leal        (%rdi,%rdi), %eax
          retq
      
      This fixes PR20681.
      
      llvm-svn: 215815
      f9a095d6
    • Abramo Bagnara's avatar
    • Nico Weber's avatar
      arm asm: Let .fpu enable instructions, PR20447. · ae050bb0
      Nico Weber authored
      I'm not very happy with duplicating the fpu->feature mapping in ARMAsmParser.cpp
      and in clang's driver. See the bug for a patch that doesn't do that, and the
      review thread [1] for why this duplication exists.
      
      1: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140811/231052.html
      llvm-svn: 215811
      ae050bb0
    • Ben Langmuir's avatar
      When loading a module with no local entities, still bump the size of the · fe971d98
      Ben Langmuir authored
      tables that correspond to ContinuousRangeMaps, since the keys to those
      maps need to be unique, or we may map to the wrong offset.
      
      This fixes a crash + malformed AST file seen when loading some modules
      that import Cocoa on Darwin, which is a module with no contents except
      imports of other modules. Unfortunately I have not been able to find a
      reduced test case that reproduces this problem.
      
      Also add an assert that we aren't mapping one key to multiple values
      in CRM.  We ought to be able to say there are no duplicate keys at all,
      but there are a bunch of 0 -> 0 mappings that are showing up, probably
      coming from the source location table.
      
      llvm-svn: 215810
      fe971d98
    • Eric Fiselier's avatar
      [LIT] Move display of unsupported and xfail tests to summary. · 5ccd9e02
      Eric Fiselier authored
      Summary:
      This patch changes the way xfail and unsupported tests are displayed. 
      This output is only displayed when the --show-unsupported/--show-xfail flags are passed to lit.
      
      Currently xfail/unsupported tests are printed during the run of the test-suite. I think its better to display this information during the summary instead.
      This patch removes the printing of these tests from when they are run to the summary.
      
      
      Reviewers: ddunbar, EricWF
      
      Reviewed By: EricWF
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D4842
      
      llvm-svn: 215809
      5ccd9e02
    • Nick Lewycky's avatar
      Clarify. · 12be8efc
      Nick Lewycky authored
      llvm-svn: 215808
      12be8efc
    • Nick Lewycky's avatar
      Try indenting to put all the text inside the block. · 367cbddf
      Nick Lewycky authored
      llvm-svn: 215807
      367cbddf
    • Nick Lewycky's avatar
      e9a77402
    • Duncan P. N. Exon Smith's avatar
      BitcodeReader: Only create one basic block for each blockaddress · 5a5fd7b1
      Duncan P. N. Exon Smith authored
      Block address forward-references are implemented by creating a
      `BasicBlock` ahead of time that gets inserted in the `Function` when
      it's eventually encountered.
      
      However, if the same blockaddress was used in two separate functions
      that were parsed *before* the referenced function (and the blockaddress
      was never used at global scope), two separate basic blocks would get
      created, one of which would be forgotten creating invalid IR.
      
      This commit changes the forward-reference logic to create only one basic
      block (and always return the same blockaddress).
      
      llvm-svn: 215805
      5a5fd7b1
    • Duncan P. N. Exon Smith's avatar
      UseListOrder: Correctly count the number of uses · 1318364e
      Duncan P. N. Exon Smith authored
      This is an off-by-one bug I found by inspection, which would only
      trigger if the bitcode writer sees more uses of a `Value` than the
      reader.  Since this is only relevant when an instruction gets upgraded
      somehow, there unfortunately isn't a reasonable way to add test
      coverage.
      
      llvm-svn: 215804
      1318364e
    • Duncan P. N. Exon Smith's avatar
      IR: Don't add inbounds to GEPs of extern_weak variables · 0c39d40c
      Duncan P. N. Exon Smith authored
      Global variables that have `extern_weak` linkage may be null, so it's
      incorrect to add `inbounds` when constant folding.
      
      This also fixes a bug when parsing global aliases, whose forward
      reference placeholders are global variables with `extern_weak` linkage.
      If GEPs to these aliases are encountered before the alias itself, the
      GEPs would incorrectly gain the `inbounds` keyword as well.
      
      llvm-svn: 215803
      0c39d40c
    • Eric Fiselier's avatar
      [libcxx] Update the way the -std= flag is chosen by CMake and LibcxxTestFormat · 1b44db22
      Eric Fiselier authored
      Summary:
      This patch does two things:
      CMake Update:
        - Add compiler flag checks for -std=c++11 and -std=c++1y and remove check for -std=c++0x.
        - Add configuration option LIBCXX_ENABLE_CXX1Y to prevent/allow -std=c++1y from being chosen as the std version. LIBCXX_ENABLE_CXX1Y is set to OFF by default.
        - if LIBCXX_ENABLE_CXX1Y is enabled then set LIBCXX_STD_VERSION to c++1y and fail if the compiler does not support -std=c++1y
        - If c++1y is not enabled then use c++11 and fail if the compiler does not support c++11.
      
      Lit Update:
        - Update lit.site.cfg.in to capture LIBCXX_STD_VERSION information as config.std.
        - Remove mentions of has_cxx0X configuration option.
        - Check for `--param std=X' passed to lit on the command line.
        - Choose the std for the tests either from command line parameter or (if it doesn't exist) the lit.site.cfg.
      
      
      
      Reviewers: mclow.lists, danalbert
      
      Reviewed By: danalbert
      
      Subscribers: emaste, rnk, ajwong, danalbert, cfe-commits
      
      Differential Revision: http://reviews.llvm.org/D4329
      
      llvm-svn: 215802
      1b44db22
    • Enrico Granata's avatar
      Enable the data formatter for std::vector<bool> on libc++ again. In recent... · 781a7b04
      Enrico Granata authored
      Enable the data formatter for std::vector<bool> on libc++ again. In recent clang builds, we are vended a different typename, which the formatter needs to match against.
      
      llvm-svn: 215801
      781a7b04
    • Enrico Granata's avatar
      When attempting to print function names with arguments in frame formatting,... · e4a4f5d5
      Enrico Granata authored
      When attempting to print function names with arguments in frame formatting, attempt to detect templated functions, and replace the argument list with values outside the template marking. Turns C::f<(this=0x00007fff5fbffb70, x=2, y=1)0>(int, int) into C::f<(C::V)0>(this=0x00007fff5fbffb70, x=2, y=1), which definitely looks more like the real thing. Fixes rdar://14882237
      
      llvm-svn: 215800
      e4a4f5d5
    • Alexander Kornienko's avatar
      AvoidCStyleCastsCheck: don't warn on casts in macros · 08cc55db
      Alexander Kornienko authored
      llvm-svn: 215799
      08cc55db
    • Enrico Granata's avatar
      In order for the debug script filename to be valid as a module name, LLDB does... · fe7295dc
      Enrico Granata authored
      In order for the debug script filename to be valid as a module name, LLDB does some textual replacements. However, if one were unaware of this, they might name their script using the 'untampered' file name and they would get no feedback about it. Add logic to LLDB to make sure we tell people about those changes if it turns out they might need to know. Fixes rdar://14310572
      
      llvm-svn: 215798
      fe7295dc
    • Andrea Di Biagio's avatar
      [DAGCombiner] Improve the folding of target independet shuffles to Undef. · b23bad11
      Andrea Di Biagio authored
      When combining a pair of shuffle nodes, check if the combined shuffle mask is
      trivially Undef. In case, immediately fold that pair of shuffles to Undef.
      
      The lack of checks for undef masks was the root-cause of a poor-codegen bug
      in the dag combiner.
      
      Example:
        %1 = shufflevector <4 x i32> %A, <4 x i32> %B, <4 x i32> <i32 4, i32 1, i32 1, i32 6>
        %2 = shufflevector <4 x i32> %1, <4 x i32> undef, <4 x i32> <i32 0, i32 4, i32 1, i32 6>
        %3 = shufflevector <4 x i32> %2, <4 x i32> undef, <4 x i32> <i32 1, i32 5, i32 3, i32 3>
      
      Before this patch, on x86 (with -mcpu=corei7) we failed to fold the entire
      sequence to Undef value and therefore we generated:
        shufps $-123, %xmm1, $xmm0
        pshufd $-46, %xmm0, %xmm0
      
      With this patch, the entire shuffle sequence is folded to Undef and no
      shuffles are generated in the output assembly.
      
      Added new test cases to test 'combine-vec-shuffle-5.ll'.
      
      llvm-svn: 215797
      b23bad11
    • Argyrios Kyrtzidis's avatar
      ac3997eb
    • Hal Finkel's avatar
      [PowerPC] Mark fixed-offset byvals as pointed-to by IR values · 41a55ad0
      Hal Finkel authored
      A byval object, even if allocated at a fixed offset (prescribed by the ABI) is
      pointed to by IR values. Most fixed-offset stack objects are not pointed-to by
      IR values, so the default is to assume this is not possible. However, we need
      to override the default in this case (instruction scheduling can cause
      miscompiles otherwise).
      
      Fixes PR20280.
      
      llvm-svn: 215795
      41a55ad0
    • Hal Finkel's avatar
      Make isAliased property for fixed-offset stack objects adjustable · 0815a05f
      Hal Finkel authored
      We used to assume that any fixed-offset stack object was not aliased. This
      meant that no IR value could point to the memory contained in such an object.
      This is a reasonable default, but is not a universally-correct
      target-independent fact. For example, on PowerPC (both Darwin and non-Darwin),
      some byval arguments are allocated at fixed offsets by the ABI. These, however,
      certainly can be pointed to by IR values. This change moves the 'isAliased'
      logic out of FixedStackPseudoSourceValue and into MFI, and allows the isAliased
      property to be overridden for fixed-offset objects.
      
      This will be used by an upcoming commit to the PowerPC backend to fix PR20280.
      
      No functionality change intended (the behavior of
      FixedStackPseudoSourceValue::isAliased has been made more conservative for
      callers that don't pass an MFI object, but I don't see any in-tree callers that
      do that).
      
      llvm-svn: 215794
      0815a05f
    • Hal Finkel's avatar
      [PowerPC] Darwin byval arguments are not immutable · dda588cd
      Hal Finkel authored
      On PPC/Darwin, byval arguments occur at fixed stack offsets in the callee's
      frame, but are not immutable -- the pointer value is directly available to the
      higher-level code as the address of the argument, and the value of the byval
      argument can be modified at the IR level.
      
      This is necessary, but not sufficient, to fix PR20280. When PR20280 is fixed in
      a follow-up commit, its test case will cover this change.
      
      llvm-svn: 215793
      dda588cd
    • Zachary Turner's avatar
      In the CMake build, convert lldbHost to be a single static library. · 4ec5d0d0
      Zachary Turner authored
      Previously lldbHost was built as multiple static libraries such as
      lldbHostCommon, lldbHostLinux, etc.  With this patch, the CMake
      build produces only a single static library, lldbHost, whose file
      set is dynamically created based on the platform.
      
      llvm-svn: 215792
      4ec5d0d0
    • Sean Silva's avatar
      Revert "Update for LLVM change (StringSaver)" · bcd500e0
      Sean Silva authored
      This reverts commit r215785 / 170ebf4f19459ae51a9561d0e65c87ee4c9b2c97.
      
      LLD has some StringSavers that need to be updated. One of which takes a
      lock and I need to investigate that more closely.
      
      llvm-svn: 215791
      bcd500e0
    • Sean Silva's avatar
      Revert "[Support] Promote cl::StringSaver to a separate utility" · db794849
      Sean Silva authored
      This reverts commit r215784 / 3f8a26f6fe16cc76c98ab21db2c600bd7defbbaa.
      
      LLD has 3 StringSaver's, one of which takes a lock when saving the
      string... Need to investigate more closely.
      
      llvm-svn: 215790
      db794849
    • Robin Morisset's avatar
      Get rid of dead code: SelectAtomic64 in X86ISelDAGtoDAG.cpp · d539f866
      Robin Morisset authored
      llvm-svn: 215789
      d539f866
    • Zachary Turner's avatar
      Still trying to fix the Make build. Link lldbHostPosix to liblldb · 76eddae8
      Zachary Turner authored
      llvm-svn: 215788
      76eddae8
    • Eric Fiselier's avatar
      Readding FreeBSD support to lit.cfg. Patch from Pawel Worach. · 983484fb
      Eric Fiselier authored
      Pawel has been using this patch on his buildbots for a while. This should
      allow the testsuite to run on FreeBSD with libcxxrt.
      
      llvm-svn: 215787
      983484fb
    • Nico Weber's avatar
      Make sure that vtables referenced from delay-parsed templates get referenced. · ae4bb8c8
      Nico Weber authored
      This fixes PR20671, see the bug for details. In short, ActOnTranslationUnit()
      calls DefineUsedVTables() and only then PerformPendingInstantiations(). But
      PerformPendingInstantiations() is what does delayed template parsing, so
      vtables only references from late-parsed templates weren't marked used.
      
      As a fix, move the SavePendingInstantiationsAndVTableUsesRAII in
      PerformPendingInstantiations() up above the delayed template parsing code.
      That way, vtables referenced from templates end up in the RAII object, and the
      call to DefineUsedVTables() in PerformPendingInstantiations() marks them used.
      
      llvm-svn: 215786
      ae4bb8c8
    • Sean Silva's avatar
      Update for LLVM change (StringSaver) · 43bd97c7
      Sean Silva authored
      There is more cleanup to be done here. Once
      llvm::sys::Process::GetArgumentVector is switched over to StringSaver,
      we can simplify this code a fair amount.
      
      llvm-svn: 215785
      43bd97c7
    • Sean Silva's avatar
      [Support] Promote cl::StringSaver to a separate utility · 42ec6fdf
      Sean Silva authored
      This class is generally useful.
      
      In breaking it out, the primary change is that it has been made
      non-virtual. It seems like being abstract led to there being 3 different
      (2 in llvm + 1 in clang) concrete implementations which disagreed about
      the ownership of the saved strings (see the manual call to free() in the
      unittest StrDupSaver; yes this is different from the CommandLine.cpp
      StrDupSaver which owns the stored strings; which is different from
      Clang's StringSetSaver which just holds a reference to a
      std::set<std::string> which owns the strings).
      
      I've identified 2 other places in the
      codebase that are open-coding this pattern:
      
        memcpy(Alloc.Allocate<char>(strlen(S)+1), S, strlen(S)+1)
      
      I'll be switching them over. They are
      * llvm::sys::Process::GetArgumentVector
      * The StringAllocator member of YAMLIO's Input class
      This also will allow simplifying Clang's driver.cpp quite a bit.
      
      Let me know if there are any other places that could benefit from
      StringSaver. I'm also thinking of adding a saveStringRef member for
      getting a stable StringRef.
      
      llvm-svn: 215784
      42ec6fdf
    • Enrico Granata's avatar
      e8bf7496
    • Zachary Turner's avatar
      Try to fix the Make build · 3c19a6ac
      Zachary Turner authored
      llvm-svn: 215782
      3c19a6ac
    • Nick Kledzik's avatar
      [mach-o] improve darwin driver 'usage' message when run with no args · 0cc04078
      Nick Kledzik authored
      llvm-svn: 215781
      0cc04078
    • Nico Weber's avatar
    • Robin Morisset's avatar
      Add two helper functions: isAtLeastAcquire, isAtLeastRelease · 97e4218f
      Robin Morisset authored
      These methods are available on AtomicOrdering values, and will be used
      in a later separate patch.
      
      llvm-svn: 215779
      97e4218f
    • Eric Christopher's avatar
      Remove another of the llvm given warnings from the list of · 29ebb012
      Eric Christopher authored
      warnings we compile with because of SWIG generated code.
      
      llvm-svn: 215778
      29ebb012