1. Mar 24, 2016
    • Vedant Kumar's avatar
      Fix a typo, Tiles -> Files, NFC · cbfe7bb7
      Vedant Kumar authored
      llvm-svn: 264218
      cbfe7bb7
    • Siva Chandra's avatar
      [JITLoaderGDB] Read jit entry struct manually. · 02f593f0
      Siva Chandra authored
      Summary:
      Though r264012 was fancy enough to make reading the jit entry struct
      work with templates, the packing and alignment attributes do not work on
      Windows. So, this change makes it plain and simple with manual reading
      of the jit entry struct.
      
      Reviewers: clayborg
      
      Subscribers: lldb-commits
      
      Differential Revision: http://reviews.llvm.org/D18379
      
      llvm-svn: 264217
      02f593f0
    • Nico Weber's avatar
      clang-cl: Add a FIXME for bumping the default msc version. · 9a952751
      Nico Weber authored
      llvm-svn: 264216
      9a952751
    • Matt Arsenault's avatar
      AMDGPU: Remove atomic inc/dec patterns · 30d37a74
      Matt Arsenault authored
      There is no benefit to these since materializing the constant 1
      requires the same number of instructions as materializing uint_max
      
      llvm-svn: 264215
      30d37a74
    • Matt Arsenault's avatar
      AMDGPU: Promote alloca should skip volatiles · 0a30e456
      Matt Arsenault authored
      llvm-svn: 264214
      0a30e456
    • Mike Aizatsky's avatar
      [sancov] code readability improvement. · 9987f43f
      Mike Aizatsky authored
      Summary: Reply to http://reviews.llvm.org/D18341
      
      Differential Revision: http://reviews.llvm.org/D18406
      
      llvm-svn: 264213
      9987f43f
    • Andrew Wilkins's avatar
      [llgo] Increment "Debug Info Version" · 0f432aa0
      Andrew Wilkins authored
      Patch by Michal Cierniak!
      
      This patch increments the "Debug Info Version" from 2 to 3.
      This is a nop if you just want to generate binaries. I verified
      that with and without this patch, when I run llgo -g on a Go
      source file, I get exactly the same binary. The purpose of the
      patch is to make it possible to run the llvm-dis tool. Without
      the patch, it is impossible to disassemble files generated with
      llgo:
      
        $ llgo -c -g -emit-llvm src/hello.go
        $ llvm-dis hello.o
        llvm-dis: warning: ignoring debug info with an invalid version (2) in hello.o
      
      Differential Revision: http://reviews.llvm.org/D18355
      
      llvm-svn: 264212
      0f432aa0
    • Nico Weber's avatar
      Fix typo in test from r264210, sigh. · dde29407
      Nico Weber authored
      (The test passes both with and without this change, but it's confusing without
      it.)
      
      llvm-svn: 264211
      dde29407
    • Nico Weber's avatar
      clang-cl: With -fmsc-version=1900, use MSVS2015 diag formatting. · fbe3adf1
      Nico Weber authored
      Remove tests that have neither a triple nor an explicit -fmsc-version flag,
      since in the absence of an -fmsc-version flag, the implicit value of the flag
      is 17 (MSVC2013) with MSVC triples but 0 (not set) for other triples, and
      the default triple is platform dependent.
      
      This relands r263974 with a test fix.
      
      llvm-svn: 264210
      fbe3adf1
    • Justin Bogner's avatar
      docs: Fix a missing language in a code-block · 91269bfd
      Justin Bogner authored
      This should fix the docs build.
      Spotted by spstarr, thanks!
      
      llvm-svn: 264209
      91269bfd
    • Justin Lebar's avatar
      [CUDA] Update docs to reflect that we no longer define __NVCC__. · 068a7949
      Justin Lebar authored
      llvm-svn: 264208
      068a7949
    • Justin Lebar's avatar
      [CUDA] Merge most of CodeGenCUDA/function-overload.cu into SemaCUDA/function-overload.cu. · e5eed04d
      Justin Lebar authored
      Summary:
      Previously we were using the codegen test to ensure that we choose the
      right overload.  But we can do this within sema, with a bit of
      cleverness.
      
      I left the constructor/destructor checks in CodeGen, because these
      overloads (particularly on the destructors) are hard to check in Sema.
      
      Reviewers: tra
      
      Subscribers: cfe-commits
      
      Differential Revision: http://reviews.llvm.org/D18386
      
      llvm-svn: 264207
      e5eed04d
    • Justin Lebar's avatar
      [CUDA] Simplify SemaCUDA/function-overload.cu test. · e82caa30
      Justin Lebar authored
      Summary:
      Principally, don't hardcode the line numbers of various notes.  This
      lets us make changes to the test without recomputing linenos everywhere.
      
      Instead, just tell -verify that we may get 0 or more notes pointing to
      the relevant function definitions.  Checking that we get exactly the
      right note isn't so important (and anyway is checked elsewhere).
      
      Reviewers: tra
      
      Subscribers: cfe-commits
      
      Differential Revision: http://reviews.llvm.org/D18385
      
      llvm-svn: 264206
      e82caa30
    • Justin Lebar's avatar
      [CUDA] Don't define __NVCC__. · 33453513
      Justin Lebar authored
      Summary:
      We decided this makes life too difficult for code authors.  For example,
      people may want to detect NVCC and disable variadic templates, which
      NVCC does not support, but which we do.
      
      Since people are going to have to change compiler flags *anyway* in
      order to compile with clang, if they really want the old behavior, they
      can pass -D__NVCC__.
      
      Tested with tensorflow and thrust, no apparent problems.
      
      Reviewers: tra
      
      Subscribers: cfe-commits
      
      Differential Revision: http://reviews.llvm.org/D18417
      
      llvm-svn: 264205
      33453513
    • Pete Cooper's avatar
      Fix more cases of UB from allocating 0 sized data. NFC. · 47e5399c
      Pete Cooper authored
      The size of a section can be zero, even when it contains atoms, so
      long as all of the atoms are also size 0.  In this case we were
      allocating space for a 0 sized buffer.
      
      Changed this to only allocate when we need the space, but also cleaned
      up all the code to use MutableArrayRef instead of uint8_t* so its much much
      safer as we get bounds checking on all of our section creation logic.
      
      llvm-svn: 264204
      47e5399c
    • Matt Arsenault's avatar
      Add missing __builtin_bitreverse8 · 08087c52
      Matt Arsenault authored
      Also add documentation for bitreverse builtins
      
      llvm-svn: 264203
      08087c52
    • Pete Cooper's avatar
      Use a memcpy to avoid unaligned store UB. · b565bdfb
      Pete Cooper authored
      On a 32-bit output, we may write LC_SOURCE_VERSION (which contains a uint64_t) to
      an unaligned address.  This changes it to use a memcpy instead which is UB safe.
      
      llvm-svn: 264202
      b565bdfb
    • Pete Cooper's avatar
      StringRef::copy shouldn't allocate anything for length 0 strings. · b08d9060
      Pete Cooper authored
      The BumpPtrAllocator currently doesn't handle zero length allocations well.
      The discussion for how to fix that is ongoing.  However, there's no need
      for StringRef::copy to actually allocate anything here anyway, so just
      return StringRef() when we get a zero length copy.
      
      Reviewed by David Blaikie
      
      llvm-svn: 264201
      b08d9060
    • Matt Arsenault's avatar
      AMDGPU: Insert moves of frame index to value operands · f43c2a0b
      Matt Arsenault authored
      Strengthen tests of storing frame indices.
      
      Right now this just creates irrelevant scheduling changes.
      
      We don't want to have multiple frame index operands
      on an instruction. There seem to be various assumptions
      that at least the same frame index will not appear twice
      in the LocalStackSlotAllocation pass.
      
      There's no reason to have this happen, and it just
      makes it easy to introduce bugs where the immediate
      offset is appplied to the storing instruction when it should
      really be applied to the value being stored as a separate
      add.
      
      This might not be sufficient. It might still be problematic
      to have an add fi, fi situation, but that's even less unlikely
      to happen in real code.
      
      llvm-svn: 264200
      f43c2a0b
    • Cong Hou's avatar
      Allow X86::COND_NE_OR_P and X86::COND_NP_OR_E to be reversed. · 94710840
      Cong Hou authored
      Currently, AnalyzeBranch() fails non-equality comparison between floating points
      on X86 (see https://llvm.org/bugs/show_bug.cgi?id=23875). This is because this
      function can modify the branch by reversing the conditional jump and removing
      unconditional jump if there is a proper fall-through. However, in the case of
      non-equality comparison between floating points, this can turn the branch
      "unanalyzable". Consider the following case:
      
      jne.BB1
      jp.BB1
      jmp.BB2
      .BB1:
      ...
      .BB2:
      ...
      
      AnalyzeBranch() will reverse "jp .BB1" to "jnp .BB2" and then "jmp .BB2" will be
      removed:
      
      jne.BB1
      jnp.BB2
      .BB1:
      ...
      .BB2:
      ...
      
      However, AnalyzeBranch() cannot analyze this branch anymore as there are two
      conditional jumps with different targets. This may disable some optimizations
      like block-placement: in this case the fall-through behavior is enforced even if
      the fall-through block is very cold, which is suboptimal.
      
      Actually this optimization is also done in block-placement pass, which means we
      can remove this optimization from AnalyzeBranch(). However, currently
      X86::COND_NE_OR_P and X86::COND_NP_OR_E are not reversible: there is no defined
      negation conditions for them.
      
      In order to reverse them, this patch defines two new CondCode X86::COND_E_AND_NP
      and X86::COND_P_AND_NE. It also defines how to synthesize instructions for them.
      Here only the second conditional jump is reversed. This is valid as we only need
      them to do this "unconditional jump removal" optimization.
      
      
      Differential Revision: http://reviews.llvm.org/D11393
      
      llvm-svn: 264199
      94710840
    • Kevin Enderby's avatar
      Fix a cut-and-paste error in the changes for r264187 which I think is · 74f58d41
      Kevin Enderby authored
      the cause of the tools/llvm-objdump/X86/macho-symbolized-disassembly.test
      crashing on linux.  Either way clearly incorrect code.
      
      llvm-svn: 264198
      74f58d41
    • Sanjay Patel's avatar
      reorganize llc checks script to allow more flexibility; NFCI · bf623017
      Sanjay Patel authored
       
      The goal is to enhance this script to be used with opt and clang:
      Group all of the regexes together, so it's easier to see what's going on.
      This will make it easier to break main() up into pieces too. 
      Also, note that some of the regexes are for x86-specific asm. 
      
      llvm-svn: 264197
      bf623017
    • Manman Ren's avatar
      15325f80
    • Derek Bruening's avatar
      [sanitizer] Add strnlen to the common interceptors · b584410b
      Derek Bruening authored
      Summary:
      Adds strnlen to the common interceptors, under the existing flag
      intercept_strlen.
      
      Removes the now-duplicate strnlen interceptor from asan and msan.
      This adds strnlen to tsan, which previously did not intercept it.
      
      Adds a new test of strnlen to the sanitizer_common test cases.
      
      Reviewers: samsonov
      
      Subscribers: zhaoqin, llvm-commits, kcc
      
      Differential Revision: http://reviews.llvm.org/D18397
      
      llvm-svn: 264195
      b584410b
    • Kevin Enderby's avatar
      More more change need as part of r264187 where ErrorOr<> was added · 8fb96b95
      Kevin Enderby authored
      to getSymbolType().
      
      llvm-svn: 264194
      8fb96b95
    • Rui Ueyama's avatar
      ELF: Split BitcodeCompiler::compile. · 961f2ff2
      Rui Ueyama authored
      http://reviews.llvm.org/D18410
      
      llvm-svn: 264193
      961f2ff2
    • Rafael Espindola's avatar
      Fix logic for which symbols to keep with comdats. · f2e71244
      Rafael Espindola authored
      If a comdat is dropped, all symbols in it are dropped.
      If a comdat is kept, the symbols survive to pass regular symbol
      resolution.
      With this patch we do that for all global symbols.
      
      The added test is a copy of test/tools/gold/X86/comdat.ll that we now
      pass.
      
      llvm-svn: 264192
      f2e71244
    • Richard Barton's avatar
      Guard a number of tests relying on threads support when built in · 3c0bc969
      Richard Barton authored
      single-threaded mode.
      
      Differential Revision: http://reviews.llvm.org/D14731
      
      llvm-svn: 264191
      3c0bc969
    • Reid Kleckner's avatar
      [asan] Export new and delete operators on Windows · 03d703bb
      Reid Kleckner authored
      This is necessary to support the dynamic CRT (/MD) with VS2015. In
      VS2015, these symbols are no longer imported from a DLL, they provided
      statically by msvcrt.lib. This means our approach of hotpatching the DLL
      no longer works.
      
      By exporting the symbols, we end up relying on the same mechanism that
      we use to intercept symbols in the static CRT (/MT) case. The ASan
      runtime always needs to appear first on the link line, and the linker
      searches for symbol definitions from left to right. This means we can
      stop hotpatching operator new and delete in the CRT, which is nice.
      
      I think that the only reason we weren't exporting the symbols already is
      because MSVC doesn't allow you to do it directly with
      __declspec(dllexport). Instead, we can use
      `#pragma comment(linker, "/export:foo")`, which is most of what the
      attribute does under the hood. It does mean we have to write down the
      mangled names of the operators, but that's not too bad.
      
      llvm-svn: 264190
      03d703bb
    • Richard Smith's avatar
      Make SemaAccess smarter about determining when a dependent class might · fd55fc86
      Richard Smith authored
      instantiate to match a friend class declaration. It's still pretty dumb,
      though.
      
      llvm-svn: 264189
      fd55fc86
    • Kevin Enderby's avatar
      Add the needed lld change for r264187 in llvm. · 2112b2c0
      Kevin Enderby authored
      Sorry had this fixed in my check out but failed mention it in my
      commit message for r264187.
      
      llvm-svn: 264188
      2112b2c0
    • Kevin Enderby's avatar
      Fix a crash in running llvm-objdump -t with an invalid Mach-O file already · 5afbc1cd
      Kevin Enderby authored
      in the test suite. While this is not really an interesting tool and option to run
      on a Mach-O file to show the symbol table in a generic libObject format
      it shouldn’t crash.
      
      The reason for the crash was in MachOObjectFile::getSymbolType() when it was
      calling MachOObjectFile::getSymbolSection() without checking its return value
      for the error case.
      
      What makes this fix require a fair bit of diffs is that the method getSymbolType() is
      in the class ObjectFile defined without an ErrorOr<> so I needed to add that all
      the sub classes.  And all of the uses needed to be updated and the return value
      needed to be checked for the error case.
      
      The MachOObjectFile version of getSymbolType() “can” get an error in trying to
      come up with the libObject’s internal SymbolRef::Type when the Mach-O symbol
      symbol type is an N_SECT type because the code is trying to select from the
      SymbolRef::ST_Data or SymbolRef::ST_Function values for the SymbolRef::Type.
      And it needs the Mach-O section to use isData() and isBSS to determine if
      it will return SymbolRef::ST_Data.
      
      One other possible fix I considered is to simply return SymbolRef::ST_Other
      when MachOObjectFile::getSymbolSection() returned an error.  But since in
      the past when I did such changes that “ate an error in the libObject code” I
      was asked instead to push the error out of the libObject code I chose not
      to implement the fix this way.
      
      As currently written both the COFF and ELF versions of getSymbolType()
      can’t get an error.  But if isReservedSectionNumber() wanted to check for
      the two known negative values rather than allowing all negative values or
      the code wanted to add the same check as in getSymbolAddress() to use
      getSection() and check for the error then these versions of getSymbolType()
      could return errors.
      
      At the end of the day the error printed now is the generic “Invalid data was
      encountered while parsing the file” for object_error::parse_failed.  In the
      future when we thread Lang’s new TypedError for recoverable error handling
      though libObject this will improve.  And where the added // Diagnostic(…
      comment is, it would be changed to produce and error message
      like “bad section index (42) for symbol at index 8” for this case.
      
      llvm-svn: 264187
      5afbc1cd
    • Sanjay Patel's avatar
      [x86] make peekThroughBitcasts() a helper function · 7876f180
      Sanjay Patel authored
      This should be hoisted further up so it can be used in DAGCombiner and other backends,
      but I'm limiting the scope in the interest of patch minimalism.
      
      It's not quite NFC because some of the replaced code was using an 'if' check rather
      than a 'while' loop, so those cases would only look through a single bitcast.
      
      llvm-svn: 264186
      7876f180
    • Chad Rosier's avatar
      [AArch64] Replace return 0 with return false. NFC. · 85c85940
      Chad Rosier authored
      llvm-svn: 264185
      85c85940
    • Richard Smith's avatar
      Make sure to perform dependent access checks when instantiating a · c7649dc7
      Richard Smith authored
      lambda-expression. We don't actually instantiate the closure type / operator()
      in the template in order to produce the closure type / operator() in the
      instantiation, so this isn't caught by the normal path.
      
      llvm-svn: 264184
      c7649dc7
    • Kyle Butt's avatar
      Codegen: [PPC] Word Rotates are Zero Extending. · 61311282
      Kyle Butt authored
      Add Word rotates to the list of instructions that are zero extending.
      This allows them to be used in dot form to compare with zero.
      
      llvm-svn: 264183
      61311282
    • Nico Weber's avatar
      clang-cl: Fix remaining bugs in interaction of /Yc and /FI /showIncludes. · f54146c1
      Nico Weber authored
      Instead of putting the /Yc header into ExtraDeps, give DependencyOutputOptions
      a dedicated field for /Yc mode, and let HeaderIncludesCallback hang on to the
      full DependencyOutputOptions object, not just ExtraDeps.
      
      Reverts parts of r263352 that are now no longer needed.
      
      llvm-svn: 264182
      f54146c1
    • Davide Italiano's avatar
      [LTO] Keep linkonce symbols when required. · bcd660a9
      Davide Italiano authored
      Similarly to how we do with linkonce_odr symbols already, but
      change their linkage to weak.
      
      llvm-svn: 264181
      bcd660a9
    • George Burgess IV's avatar
      Fix bugs in the MemorySSA walker. · 0e489868
      George Burgess IV authored
      There are a few bugs in the walker that this patch addresses.
      Primarily:
      - Caching can break when we have multiple BBs without phis
      - We weren't optimizing some phis properly
      - Because of how the DFS iterator works, there were times where we
        wouldn't cache any results of our DFS
      
      I left the test cases with FIXMEs in, because I'm not sure how much
      effort it will take to get those to work (read: We'll probably
      ultimately have to end up redoing the walker, or we'll have to come up
      with some creative caching tricks), and more test coverage = better.
      
      Differential Revision: http://reviews.llvm.org/D18065
      
      llvm-svn: 264180
      0e489868
    • Easwaran Raman's avatar
      Add getBlockProfileCount method to BlockFrequencyInfo · 12b79aa0
      Easwaran Raman authored
      Differential Revision: http://reviews.llvm.org/D18233
      
      llvm-svn: 264179
      12b79aa0