1. Jun 18, 2016
    • Reid Kleckner's avatar
      Fix most MSVC warnings in compiler-rt profiling library · 652d70f3
      Reid Kleckner authored
      Here's the warnings and how they were fixed:
      
      - InstrProfilingUtil.c(110): warning C4013: '_open_osfhandle' undefined; assuming extern returning int
      
      Include io.h to get the prototype.
      
      - warning C4005: 'FILE_MAP_EXECUTE': macro redefinition
      
      Stop trying to support pre-XP versions of Windows, don't attempt to
      define this macro.
      
      - InstrProfilingWriter.c(271): warning C4221: nonstandard extension used: 'Data': cannot be initialized using address of automatic variable 'Header'
      - InstrProfilingWriter.c(275): warning C4221: nonstandard extension used: 'Data': cannot be initialized using address of automatic variable 'Zeroes'
      
      Turn this warning off. This is definitely legal in C++, all compilers
      accept it, and I only have room for half of one language standard in my
      brain.
      
      - InstrProfilingValue.c(320): warning C4113: 'uint32_t (__cdecl *)()' differs in parameter lists from 'uint32_t (__cdecl *)(void)'
      
      Fix this with an explicit (void) in the prototype.
      
      - InstrProfilingMerge.c.obj : warning LNK4006: _VPMergeHook already defined in InstrProfilingMergeFile.c.obj; second definition ignored
      
      Last remaining warning. This is from linking a selectany definition with
      a strong definition. We need to sort out weak symbols in compiler-rt in
      general, though.
      
      llvm-svn: 273026
      652d70f3
    • James Y Knight's avatar
      Support expanding partial-word cmpxchg to full-word cmpxchg in AtomicExpandPass. · 148a6469
      James Y Knight authored
      Many CPUs only have the ability to do a 4-byte cmpxchg (or ll/sc), not 1
      or 2-byte. For those, you need to mask and shift the 1 or 2 byte values
      appropriately to use the 4-byte instruction.
      
      This change adds support for cmpxchg-based instruction sets (only SPARC,
      in LLVM). The support can be extended for LL/SC-based PPC and MIPS in
      the future, supplanting the ISel expansions those architectures
      currently use.
      
      Tests added for the IR transform and SPARCv9.
      
      Differential Revision: http://reviews.llvm.org/D21029
      
      llvm-svn: 273025
      148a6469
    • Davide Italiano's avatar
      [Codegen] Change PICLevel. · 4cccc488
      Davide Italiano authored
      We convert `Default` to `NotPIC` so that target independent code
      can reason about this correctly.
      
      Differential Revision:  http://reviews.llvm.org/D21394
      
      llvm-svn: 273024
      4cccc488
    • Justin Bogner's avatar
      LoopSimplifyCFG: Prefer `const auto &` to `auto &`, for clarity. NFC · 78eebe77
      Justin Bogner authored
      llvm-svn: 273023
      78eebe77
    • Rafael Espindola's avatar
      Don't use the new x86 relax relocations on the gold plugin. · aee1a0e4
      Rafael Espindola authored
      Should bring back the bots with old versions.
      
      llvm-svn: 273022
      aee1a0e4
    • Reid Kleckner's avatar
      Fix some warnings in the MSVC build · d0680ad7
      Reid Kleckner authored
      - Fixes warnings about the ignored -fms-compatibility-version flag.
      - Fixes warnings about overriding /W4 with /W3 and back.
      - Fixes a warning where PREFETCH() expanded to nothing in a braceless if
        block.
      
      llvm-svn: 273021
      d0680ad7
    • David Majnemer's avatar
      [CodeGen] Use pointer-sized integers for ptrtoint sources · 3370c20c
      David Majnemer authored
      Given something like:
      void *v = (void *)100;
      
      We need to synthesize a ptrtoint operation from 100.  During constant
      emission, we choose i64 as the type for our constant because it
      guaranteed not to drop any bits from our CharUnits representation of the
      value.  However, this is suboptimal for 32-bit targets: LLVM passes like
      GlobalOpt will get confused by these sorts of casts resulting in
      pessimization.
      
      Instead, make sure the ptrtoint operand has a pointer-sized integer
      type.
      
      llvm-svn: 273020
      3370c20c
    • Rafael Espindola's avatar
      Change RelaxELFRelocations for llc. · 9f86baeb
      Rafael Espindola authored
      As a developer tool it makes sense for it to use the new relocations.
      
      llvm-svn: 273019
      9f86baeb
    • Saleem Abdulrasool's avatar
      test: generalise the matching · 003bd8c3
      Saleem Abdulrasool authored
      Use a regex for the clang version as that will change all the time.
      
      llvm-svn: 273018
      003bd8c3
    • Rafael Espindola's avatar
      Change RelaxELFRelocations' default. · f5e7d63a
      Rafael Espindola authored
      NFC to the existing clients since they all set it already.
      
      llvm-svn: 273017
      f5e7d63a
    • Saleem Abdulrasool's avatar
      Driver: introduce and use `-isystem-after` for cross-windows · 88879e65
      Saleem Abdulrasool authored
      This mirrors the many other -i*after options to insert a new system search
      directory at the end of the search path.  This makes it possible to actually
      inject a search path after the resource dir.  This option is similar in spirit
      to the /imsvc option in the clang-cl driver.  This is needed to properly use the
      driver for Windows targets where the clang headers wrap some of the system
      headers.
      
      This concept is actually useful on other targets (e.g. Linux) and would be
      really easy to support on the core toolchain.
      
      llvm-svn: 273016
      88879e65
    • Yaxun Liu's avatar
      [OpenCL] Allow -std={cl|CL}{|1.1|1.2|2.0} in driver · b5044fe4
      Yaxun Liu authored
      Fix a regression which forbids using -std=cl|CL1.1|CL1.2|CL2.0 in driver.
      
      Allow -std and -cl-std={cl|CL}{|1.1|1.2|2.0}.
      
      Differential Revision: http://reviews.llvm.org/D20630
      
      llvm-svn: 273015
      b5044fe4
    • Rafael Espindola's avatar
      Change the default of -relax-relocations. · e021e851
      Rafael Espindola authored
      llvm-mc is a developer tool, as such it make sense for it to use new
      features by default.
      
      This doesn't change the user facing clang, which still defaults to non
      relaxable relocations.
      
      llvm-svn: 273014
      e021e851
    • Rafael Espindola's avatar
      This tests depends on non-relaxable relocations. · 6fcbbcb3
      Rafael Espindola authored
      Make that explicit.
      
      llvm-svn: 273013
      6fcbbcb3
    • Bryan Chan's avatar
      [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations · d346ae6e
      Bryan Chan authored
      Summary:
      Some GCC 5 installations store the libstdc++ includes and GCC-specific files in paths without 
      the minor part of the version number, such as
      
        /usr/include/c++/5
        /usr/lib64/gcc/x86_64-suse-linux/5
      
      Reviewers: cfe-commits, thiagomacieira, jroelofs
      
      Subscribers: tinti, jroelofs
      
      Differential Revision: http://reviews.llvm.org/D14727
      
      llvm-svn: 273012
      d346ae6e
    • Sanjay Patel's avatar
      [InstCombine] allow more than one use for vector bitcast folding with selects · 216d8cf7
      Sanjay Patel authored
      The motivating example for this transform is similar to D20774 where bitcasts interfere
      with a single cmp/select sequence, but in this case we have 2 uses of each bitcast to 
      produce min and max ops:
      
      define void @minmax_bc_store(<4 x float> %a, <4 x float> %b, <4 x float>* %ptr1, <4 x float>* %ptr2) {
        %cmp = fcmp olt <4 x float> %a, %b
        %bc1 = bitcast <4 x float> %a to <4 x i32>
        %bc2 = bitcast <4 x float> %b to <4 x i32>
        %sel1 = select <4 x i1> %cmp, <4 x i32> %bc1, <4 x i32> %bc2
        %sel2 = select <4 x i1> %cmp, <4 x i32> %bc2, <4 x i32> %bc1
        %bc3 = bitcast <4 x float>* %ptr1 to <4 x i32>*
        store <4 x i32> %sel1, <4 x i32>* %bc3
        %bc4 = bitcast <4 x float>* %ptr2 to <4 x i32>*
        store <4 x i32> %sel2, <4 x i32>* %bc4
        ret void
      }
      
      With this patch, we move the selects up to use the input args which allows getting rid of
      all of the bitcasts:
      
      define void @minmax_bc_store(<4 x float> %a, <4 x float> %b, <4 x float>* %ptr1, <4 x float>* %ptr2) {
        %cmp = fcmp olt <4 x float> %a, %b
        %sel1.v = select <4 x i1> %cmp, <4 x float> %a, <4 x float> %b
        %sel2.v = select <4 x i1> %cmp, <4 x float> %b, <4 x float> %a
        store <4 x float> %sel1.v, <4 x float>* %ptr1, align 16
        store <4 x float> %sel2.v, <4 x float>* %ptr2, align 16
        ret void
      }
      
      The asm for x86 SSE then improves from:
      
      movaps  %xmm0, %xmm2
      cmpltps %xmm1, %xmm2
      movaps  %xmm2, %xmm3
      andnps  %xmm1, %xmm3
      movaps  %xmm2, %xmm4
      andnps  %xmm0, %xmm4
      andps %xmm2, %xmm0
      orps  %xmm3, %xmm0
      andps %xmm1, %xmm2
      orps  %xmm4, %xmm2
      movaps  %xmm0, (%rdi)
      movaps  %xmm2, (%rsi)
      
      To:
      
      movaps  %xmm0, %xmm2
      minps %xmm1, %xmm2
      maxps %xmm0, %xmm1
      movaps  %xmm2, (%rdi)
      movaps  %xmm1, (%rsi)
      
      The TODO comments show that we're limiting this transform only to vectors and only to bitcasts
      because we need to improve other transforms or risk creating worse codegen.
      
      Differential Revision: http://reviews.llvm.org/D21190
      
      llvm-svn: 273011
      216d8cf7
    • David Majnemer's avatar
      [CodeView] Refactor enumerator emission · da9548f9
      David Majnemer authored
      This addresses Amjad's review comments on D21442.
      
      llvm-svn: 273010
      da9548f9
    • Reid Kleckner's avatar
      [codeview] Make function names more consistent with MSVC · ac945e27
      Reid Kleckner authored
      Names in function id records don't include nested name specifiers or
      template arguments, but names in the symbol stream include both.
      
      For the symbol stream, instead of having Clang put the fully qualified
      name in the subprogram display name, recreate it from the subprogram
      scope chain. For the type stream, take the unqualified name and chop of
      any template arguments.
      
      This makes it so that CodeView DI metadata is more similar to DWARF DI
      metadata.
      
      llvm-svn: 273009
      ac945e27
    • Reid Kleckner's avatar
      [codeview] Stop emitting fully qualified subprogram display names · 829398e5
      Reid Kleckner authored
      This effectively reverts r255744, and leaves the printing option tweaks.
      
      We can add the name qualifiers easily in the backend.
      
      llvm-svn: 273008
      829398e5
    • Nirav Dave's avatar
      Refactor and cleanup Assembly Parsing / Lexing · fd91041c
      Nirav Dave authored
      Recommiting after fixing non-atomic insert to front of SmallVector in
      MCAsmLexer.h
      
      Add explicit Comment Token in Assembly Lexing for future support for
      outputting explicit comments from inline assembly. As part of this,
      CPPHash Directives are now explicitly distinguished from Hash line
      comments in Lexer.
      
      Line comments are recorded as EndOfStatement tokens, not Comment tokens
      to simplify compatibility with current TargetParsers. This slightly
      complicates comment output.
      
      This remove all lexing tasks out of the parser, does minor cleanup
      to remove extraneous newlines Asm Output, and some improvements white
      space handling.
      
      Reviewers: rtrieu, dwmw2, rnk
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D20009
      
      llvm-svn: 273007
      fd91041c
  2. Jun 17, 2016