1. Jun 14, 2016
    • Adam Nemet's avatar
      Add loop pragma for Loop Distribution · 2de463ec
      Adam Nemet authored
      Summary:
      This is similar to other loop pragmas like 'vectorize'.  Currently it
      only has state values: distribute(enable) and distribute(disable).  When
      one of these is specified the corresponding loop metadata is generated:
      
        !{!"llvm.loop.distribute.enable", i1 true/false}
      
      As a result, loop distribution will be attempted on the loop even if
      Loop Distribution in not enabled globally.  Analogously, with 'disable'
      distribution can be turned off for an individual loop even when the pass
      is otherwise enabled.
      
      There are some slight differences compared to the existing loop pragmas.
      
      1. There is no 'assume_safety' variant which makes its handling slightly
      different from 'vectorize'/'interleave'.
      
      2. Unlike the existing loop pragmas, it does not have a corresponding
      numeric pragma like 'vectorize' -> 'vectorize_width'.  So for the
      consistency checks in CheckForIncompatibleAttributes we don't need to
      check it against other pragmas.  We just need to check for duplicates of
      the same pragma.
      
      Reviewers: rsmith, dexonsmith, aaron.ballman
      
      Subscribers: bob.wilson, cfe-commits, hfinkel
      
      Differential Revision: http://reviews.llvm.org/D19403
      
      llvm-svn: 272656
      2de463ec
    • Simon Dardis's avatar
      [mips][atomics] Fix atomic instruction descriptions and uses. · 4fbf76f7
      Simon Dardis authored
      PR27458 highlights that the MIPS backend does not have well formed
      MIR for atomic operations (among other errors).
      
      This patch adds expands and corrects the LL/SC descriptions and uses
      for MIPS(64).
      
      Reviewers: dsanders, vkalintiris
      
      Differential Review: http://reviews.llvm.org/D19719
      
      llvm-svn: 272655
      4fbf76f7
    • Daniel Jasper's avatar
      clang-format: [JS] Support annotated classes. · 6465008e
      Daniel Jasper authored
      llvm-svn: 272654
      6465008e
    • Roger Ferrer Ibanez's avatar
      Reverting "Warn when taking address of a packed member" · 985c0c27
      Roger Ferrer Ibanez authored
      This new diagnostic is causing some false positives that have to be addressed.
      
      This reverts commit 272552
      
      llvm-svn: 272653
      985c0c27
    • Daniel Sanders's avatar
      [mips][ias] Implement one N32 case (of two) for .cpsetup. · e858136d
      Daniel Sanders authored
      This patch implements the N32 case where -mno-shared is in effect. The case
      where -mshared is in effect will be added later since doing that now requires
      additional changes to how we handle %hi(%neg(%gp_rel(foo))) expressions to
      emit the three relocations as three relocations (currently only one of the
      three would be emitted) which then requires further changes to our MCFixup
      handling.
      
      While we could fix both cases together, fixing the -mno-shared case allows us
      to fix the ELFCLASS bug (where N32 incorrectly uses ELFCLASS64 instead of
      ELFCLASS32) in a way that allows cpsetup.s to check for a correct output instead
      of another incorrect output.
      
      Reviewers: sdardis
      
      Subscribers: dsanders, llvm-commits, sdardis
      
      Differential Revision: http://reviews.llvm.org/D21131
      
      llvm-svn: 272652
      e858136d
    • Simon Pilgrim's avatar
    • Adam Nemet's avatar
      [LoopVer] Remove an assert that's redundant now. NFC · 57fb8989
      Adam Nemet authored
      Ensuring that the PHI are all single-operand is not performed in the
      second pass added by the previous pass.  This removes the assert from
      the first pass.
      
      llvm-svn: 272650
      57fb8989
    • Adam Nemet's avatar
      [LoopVer] Update all existing PHIs in the exit block · 73a26957
      Adam Nemet authored
      We only used to add the edge from the cloned loop to PHIs that
      corresponded to values defined by the loop.  We need to do this for all
      PHIs obviously since we need a PHI operand for each incoming edge.
      
      This includes things like PHIs with a constant value or with values
      defined before the original loop (see the testcases).
      
      After the patch the PHIs are added to the exit block in two passes.
      
      In the first pass we ensure there is a single-operand (LCSSA) PHI for
      each value defined by the loop.
      
      In the second pass we loop through each (single-operand) PHI and add the
      value for the edge from the cloned loop.  If the value is defined in the
      loop we'll use the cloned instruction from the cloned loop.
      
      Fixes PR28037
      
      llvm-svn: 272649
      73a26957
    • Simon Dardis's avatar
      [mips] MIPS32/64 itineraries · e661e528
      Simon Dardis authored
      Itineraries for some pre MIPSR6 and EVA instructions. Some pseudo expanded
      instructions are marked as having no scheduling info.
      
      Reviewers: dsanders, vkalintiris
      
      Differential Review: http://reviews.llvm.org/D20418
      
      llvm-svn: 272648
      e661e528
    • Daniel Sanders's avatar
      [mips][dsp] Fix use without def on DSPCtrl registers read by rddsp intrinsic. · 435a6534
      Daniel Sanders authored
      Reviewers: sdardis
      
      Subscribers: dsanders, sdardis, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D21063
      
      llvm-svn: 272647
      435a6534
    • Daniel Sanders's avatar
      [mips][msa] copyPhysReg() should not set RegState::Define on result of CTCMSA. · d2a49ec3
      Daniel Sanders authored
      Summary:
      The machine verifier reports 'Explicit operand marked as def' when it is
      manually specified even though it agrees with the operand info.
      
      Reviewers: sdardis
      
      Subscribers: dsanders, sdardis, llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D21065
      
      llvm-svn: 272646
      d2a49ec3
    • Daniel Sanders's avatar
      [mips] Defer validity check for CPU/ABI pairs and improve error message for invalid cases. · 32b2d6b1
      Daniel Sanders authored
      Summary:
      The validity of ABI/CPU pairs is no longer checked on the fly but is
      instead checked after initialization. As a result, invalid CPU/ABI pairs
      can be reported as being known but invalid instead of being unknown. For
      example, we now emit:
        error: ABI 'n32' is not supported on CPU 'mips32r2'
      instead of:
        error: unknown target ABI 'n64'
      
      Reviewers: atanasyan
      
      Subscribers: sdardis, cfe-commits
      
      Differential Revision: http://reviews.llvm.org/D21023
      
      llvm-svn: 272645
      32b2d6b1
    • Diana Picus's avatar
      [SelectionDAG] Remove exit-on-error flag from test (PR27765) · bae1d89e
      Diana Picus authored
      The exit-on-error flag in the ARM test is necessary in order to avoid an
      unreachable in the DAGTypeLegalizer, when trying to expand a physical register.
      We can also avoid this situation by introducing a bitcast early on, where the
      invalid scalar-to-vector conversion is detected.
      
      We also add a test for PowerPC, which goes through a similar code path in the
      SelectionDAGBuilder.
      
      Fixes PR27765.
      
      Differential Revision: http://reviews.llvm.org/D21061
      
      llvm-svn: 272644
      bae1d89e
    • Igor Breger's avatar
      re-generate the tests using the update_llc_test_checks.py script · 484bace2
      Igor Breger authored
      llvm-svn: 272643
      484bace2
    • Eric Fiselier's avatar
      Update errcat.objects tests so they test the bug fixed in r272640. · db72c625
      Eric Fiselier authored
      llvm-svn: 272642
      db72c625
    • Eric Fiselier's avatar
      Fix syntax error in r272640. · 61df7909
      Eric Fiselier authored
      llvm-svn: 272641
      61df7909
    • Eric Fiselier's avatar
      79e0574d
    • Eric Fiselier's avatar
      d046d542
    • Eric Fiselier's avatar
      Add missing include · 9275b219
      Eric Fiselier authored
      llvm-svn: 272638
      9275b219
    • Eric Fiselier's avatar
      Temporarily XFAIL variadic lock_guard mangling test for GCC 4.9 · 596d4087
      Eric Fiselier authored
      llvm-svn: 272637
      596d4087
    • Jason Molenda's avatar
      Add support to PlatformRemoteiOS, PlatformRemoteAppleWatch, and · 27be91ca
      Jason Molenda authored
      PlatformRemoteAppleTV to check the target.exec-search-paths 
      directories for files after looking in the SDK.  An additional
      wrinkle is that the remote file path may be something like
      ".../UIFoundation.framework/UIFoundation" and in 
      target.exec-search-paths we will have "UIFoundation.framework".
      Looking for just the filename of the path is not sufficient -
      we need to also look for it by the parent directories because
      this may be a darwin bundle/framework like the UIFoundation
      example.
      
      We really need to make a PlatformRemoteAppleDevice and have
      PlatformRemoteiOS, PlatformRemoteAppleWatch, and PlatformRemoteAppleTV
      inherit from it.  These three classes are 98% identical code.
      
      <rdar://problem/25976619> 
      
      llvm-svn: 272635
      27be91ca
    • Eric Fiselier's avatar
      Implement variadic lock_guard. · 48f35e07
      Eric Fiselier authored
      Summary:
      This patch implements the variadic `lock_guard` paper. 
      
      Making `lock_guard` variadic is a ABI breaking change because the specialization `lock_guard<_Mutex>` mangles differently then when it was the primary template. This change only provides variadic `lock_guard` in ABI V2 or when `_LIBCPP_ABI_VARIADIC_LOCK_GUARD` is defined.
      
      Note that in ABI V2 `lock_guard` must always be declared as a variadic template, even in C++03, in order to keep the ABI consistent. For this reason `lock_guard` is forward declared as a variadic template in all standard dialects and therefore depends on variadic templates being provided as an extension in C++03. All supported versions of Clang and GCC provide this extension.
      
      
      
      
      Reviewers: mclow.lists
      
      Subscribers: K-ballo, mclow.lists, cfe-commits
      
      Differential Revision: http://reviews.llvm.org/D21260
      
      llvm-svn: 272634
      48f35e07
    • Eric Fiselier's avatar
      Make system_error::message() thread safe. Fixes PR25598. · 9778a6d8
      Eric Fiselier authored
      Summary:
      system_error::message() uses `strerror` for the generic and system categories. This function is not thread safe.
      
      The fix is to use `strerror_r`. It has been available since 2001 for GNU libc and since BSD 4.4 on FreeBSD/OS X.
      On platforms with GNU libc the extended version is used which always returns a valid string, even if an error occurs.
      
      In single-threaded builds `strerror` is still used.
      
      See https://llvm.org/bugs/show_bug.cgi?id=25598
      
      Reviewers: majnemer, mclow.lists
      
      Subscribers: erik65536, cfe-commits, emaste
      
      Differential Revision: http://reviews.llvm.org/D20903
      
      llvm-svn: 272633
      9778a6d8
    • Eric Fiselier's avatar
      Ignore depricated warnings from <ext/hash_map> and <ext/hash_set> · 10e3d176
      Eric Fiselier authored
      llvm-svn: 272632
      10e3d176
    • Faisal Vali's avatar
      Fix PR28100 - Allow redeclarations of deleted explicit specializations. · 81a88bee
      Faisal Vali authored
      See https://llvm.org/bugs/show_bug.cgi?id=28100.
      
      In r266561 when I implemented allowing explicit specializations of function templates to override deleted status, I mistakenly assumed (and hence introduced a violable assertion) that when an explicit specialization was being declared, the corresponding specialization of the most specialized function template that it would get linked to would always be the one that was implicitly generated - and so if it was marked as 'deleted' it must have inherited it from the primary template and so should be safe to reset its deleted status, and set it to being an explicit specialization.  Obviously during redeclaration of a deleted explicit specialization, in order to avoid a recursive reset, we need to check that the previous specialization is not an explicit specialization (instead of assuming and asserting it) and that it hasn't been referenced, and so only then is it safe to reset its 'deleted' status.
      
      All regression tests pass.
      
      Thanks to Zhendong Su for reporting the bug and David Majnemer for tracking it to my commit r266561, and promptly bringing it to my attention.
      
      llvm-svn: 272631
      81a88bee
    • Davide Italiano's avatar
      [PM] Port Mem2Reg to the new pass manager. · cccf4f01
      Davide Italiano authored
      llvm-svn: 272630
      cccf4f01
    • Eric Fiselier's avatar
      Fix warnings in tests. · 3245e1f3
      Eric Fiselier authored
      llvm-svn: 272629
      3245e1f3
    • David Majnemer's avatar
      [Parser] Handle __pragma(pack, etc. after type definitions · 15b311c7
      David Majnemer authored
      Support certain MS pragmas right after the closing curly brace of a
      class.  Clang did not expect __pragma in this position.
      
      This fixes PR28094.
      
      llvm-svn: 272628
      15b311c7
    • Craig Topper's avatar
      [AVX512] Use AND32ri8 instead of AND32ri when anding with 1 to create single... · 34d97078
      Craig Topper authored
      [AVX512] Use AND32ri8 instead of AND32ri when anding with 1 to create single bit masks. This results in a smaller encoding.
      
      llvm-svn: 272627
      34d97078
    • Craig Topper's avatar
      [AVX512] Use MOVZX32 instead of MOVZ16 for loading single v8/v4/v2/v1 masks... · 99e30e6a
      Craig Topper authored
      [AVX512] Use MOVZX32 instead of MOVZ16 for loading single v8/v4/v2/v1 masks when KMOVB is not available. This has better behavior with respect to partial register stalls since it won't need to preserve the upper 16-bits of the GPR.
      
      llvm-svn: 272626
      99e30e6a
    • Craig Topper's avatar
      [AVX512] Add patterns for zero-extending a mask that use the def of... · ddab3953
      Craig Topper authored
      [AVX512] Add patterns for zero-extending a mask that use the def of KMOVW/KMOVB without going through an EXTRACT_SUBREG and a MOVZX.
      
      llvm-svn: 272625
      ddab3953
    • Craig Topper's avatar
      [AVX512] Add tests for zero extending masks that show an unnecessary movzx... · cbe54a4b
      Craig Topper authored
      [AVX512] Add tests for zero extending masks that show an unnecessary movzx instruction. A followup patch will remove that instruction, but adding the tests first to make the more obvious.
      
      llvm-svn: 272624
      cbe54a4b
    • Serge Pavlov's avatar
      Detect recursive default argument definition · b82a9401
      Serge Pavlov authored
      If definition of default function argument uses itself, clang crashed,
      because corresponding function parameter is not associated with the default
      argument yet. With this fix clang emits appropriate error message.
      
      This change fixes PR28105.
      
      Differential Revision: http://reviews.llvm.org/D21301
      
      llvm-svn: 272623
      b82a9401
    • Eric Fiselier's avatar
      Remove unused local var. Patch from STL@microsoft.com · 84685fc8
      Eric Fiselier authored
      llvm-svn: 272622
      84685fc8
    • Eric Fiselier's avatar
      Prevent truncation warning. Patch from STL@microsoft.com · b03da3b6
      Eric Fiselier authored
      llvm-svn: 272621
      b03da3b6
    • Eric Fiselier's avatar
      f81cfbab
    • Eric Fiselier's avatar
      Rename variables to prevent shadowing. Patch from STL@microsoft.com · f4755f5b
      Eric Fiselier authored
      llvm-svn: 272619
      f4755f5b
    • Eric Fiselier's avatar
      Avoid name shadowing in test. Patch from STL@microsoft.com · b2cdce48
      Eric Fiselier authored
      llvm-svn: 272618
      b2cdce48
    • Eric Fiselier's avatar
      Silence more unused variable warnings. Patch from STL@microsoft.com · 06d14341
      Eric Fiselier authored
      llvm-svn: 272617
      06d14341
    • Sean Silva's avatar
      Fix for (benign) uninitialized read caught by UBSan bot. · e2249f21
      Sean Silva authored
      What happened here is that in the new PM there is a bunch of new copying
      (actually, moving) and so this reads the HasProfileData member in
      situations where it used to not be read.
      It used to only be read strictly in the "runOnFunction" method and its
      callees, where is *is* initialized (even after my patch).
      So this ends up being benign as far as functional behavior of the
      compiler (since we set HasProfileData in the "runImpl" method before we
      ever make decisions based on it).
      
      It's awesome that UBSan caught this. It highlights one more thing to
      watch out for when porting passes.
      
      Sanitizer bot log was:
      
      -- Testing: 17049 tests, 32 threads --
      Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80..
      FAIL: LLVM :: Transforms/JumpThreading/thread-loads.ll (15184 of 17049)
      ******************** TEST 'LLVM :: Transforms/JumpThreading/thread-loads.ll' FAILED ********************
      Script:
      --
      /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/opt < /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/Transforms/JumpThreading/thread-loads.ll -jump-threading -S | /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/FileCheck /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/Transforms/JumpThreading/thread-loads.ll
      /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/opt < /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/Transforms/JumpThreading/thread-loads.ll -passes=jump-threading -S | /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/FileCheck /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/Transforms/JumpThreading/thread-loads.ll
      --
      Exit Code: 2
      
      Command Output (stderr):
      --
      /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Transforms/Scalar/JumpThreading.h:90:57: runtime error: load of value 136, which is not a valid value for type 'bool'
          #0 0x2c33ba1 in llvm::JumpThreadingPass::JumpThreadingPass(llvm::JumpThreadingPass&&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Transforms/Scalar/JumpThreading.h:90:57
          #1 0x2bc88e4 in void llvm::PassManager<llvm::Function>::addPass<llvm::JumpThreadingPass>(llvm::JumpThreadingPass) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/PassManager.h:282:40
          #2 0x2bb2682 in llvm::PassBuilder::parseFunctionPassName(llvm::PassManager<llvm::Function>&, llvm::StringRef) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/Passes/PassRegistry.def:133:1
          #3 0x2bb4914 in llvm::PassBuilder::parseFunctionPassPipeline(llvm::PassManager<llvm::Function>&, llvm::StringRef&, bool, bool) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/Passes/PassBuilder.cpp:489:12
          #4 0x2bb6f81 in llvm::PassBuilder::parsePassPipeline(llvm::PassManager<llvm::Module>&, llvm::StringRef, bool, bool) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/Passes/PassBuilder.cpp:674:10
          #5 0x986690 in llvm::runPassPipeline(llvm::StringRef, llvm::LLVMContext&, llvm::Module&, llvm::TargetMachine*, llvm::tool_output_file*, llvm::StringRef, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/opt/NewPMDriver.cpp:85:8
          #6 0x9af25e in main /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/opt/opt.cpp:468:12
          #7 0x7fd7e27dbf44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f44)
          #8 0x960157 in _start (/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/opt+0x960157)
      
      FileCheck error: '-' is empty.
      FileCheck command line:  /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/FileCheck /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/Transforms/JumpThreading/thread-loads.ll
      
      --
      
      ********************
      Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
      Testing Time: 128.90s
      ********************
      Failing Tests (1):
          LLVM :: Transforms/JumpThreading/thread-loads.ll
      
        Expected Passes    : 16725
        Expected Failures  : 129
        Unsupported Tests  : 194
        Unexpected Failures: 1
      
      llvm-svn: 272616
      e2249f21