1. Apr 06, 2019
    • Nico Weber's avatar
      gn build: Merge 357768 and 357770 · 226a9b96
      Nico Weber authored
      llvm-svn: 357783
      226a9b96
    • Sanjay Patel's avatar
      [InstCombine] add tests for fdiv+fmul; NFC · 79df4454
      Sanjay Patel authored
      llvm-svn: 357782
      79df4454
    • Nico Weber's avatar
      gn build: Merge r357719 · fbe13ccd
      Nico Weber authored
      llvm-svn: 357781
      fbe13ccd
    • Sanjay Patel's avatar
      [InstCombine] add tests for sqrt+fdiv+fmul; NFC · 7e3e7f80
      Sanjay Patel authored
      Examples based on recent llvm-dev thread. These are specific
      patterns of more general enhancements that would solve these.
      
      llvm-svn: 357780
      7e3e7f80
    • Evgeny Mankov's avatar
      [CUDA][Windows] Last fix for the clang Bug 38811 "Clang fails to compile with... · 66a8b07c
      Evgeny Mankov authored
      [CUDA][Windows] Last fix for the clang Bug 38811 "Clang fails to compile with CUDA-9.x on Windows" (https://bugs.llvm.org/show_bug.cgi?id=38811).
      
      [IMPORTANT]
      With that last fix, CUDA has just started being compiling by clang on Windows after nearly a year and two clang’s major releases (7 and 8).
      As long as the last LLVM release, in which clang was compiling CUDA on Windows successfully, was 6.0.1, this fix and two previous have to be included into upcoming 7.1.0 and 8.0.1 releases.
      
      [How to repro]
      clang++.exe -x cuda "c:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.0\0_Simple\simplePrintf\simplePrintf.cu" -I"c:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.0\common\inc" --cuda-gpu-arch=sm_50 --cuda-path="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0" -L"c:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64" -lcudart.lib  -v
      
      [Output]
      In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327:
      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:390:11: error: no matching function for call to '__isinfl'
        return (__isinfl(a) != 0);
                ^~~~~~~~
      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2662:14: note: candidate function not viable: call to __host__ function from __device__ function
      __func__(int __isinfl(long double a))
                   ^
      In file included from <built-in>:1:
      In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327:
      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:438:11: error: no matching function for call to '__isnanl'
        return (__isnanl(a) != 0);
                ^~~~~~~~
      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2672:14: note: candidate function not viable: call to __host__ function from __device__ function
      __func__(int __isnanl(long double a))
                   ^
      In file included from <built-in>:1:
      In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327:
      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:486:11: error: no matching function for call to '__finitel'
        return (__finitel(a) != 0);
                ^~~~~~~~~
      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2652:14: note: candidate function not viable: call to __host__ function from __device__ function
      __func__(int __finitel(long double a))
                   ^
      3 errors generated when compiling for sm_50.
      
      [Solution]
      Add missing long double device functions' declarations. Provide only declarations to prevent any use of long double on the device side, because CUDA does not support long double on the device side.
      
      [Testing]
      {Windows 10, Ubuntu 16.04.5}/{Visual C++ 2017 15.9.9, gcc+ 5.4.0}/CUDA {8.0, 9.0, 9.1, 9.2, 10.0, 10.1}
      
      Reviewed by: Artem Belevich
      
      Differential Revision: http://reviews.llvm.org/D60220
      
      llvm-svn: 357779
      66a8b07c
    • Saleem Abdulrasool's avatar
      lit: support long paths on Windows · d3a85a26
      Saleem Abdulrasool authored
      Use ctypes to call into SHFileOperationW with the extended NT path to allow us
      to remove paths which exceed 261 characters on Windows. This functionality is
      exercised by swift's test suite.
      
      llvm-svn: 357778
      d3a85a26
    • Zachary Turner's avatar
      Add documentation for PDB TPI/IPI Stream. · 85cc7955
      Zachary Turner authored
      llvm-svn: 357777
      85cc7955
    • Sanjay Patel's avatar
      9965f5aa
    • Louis Dionne's avatar
      [libc++] Fix error flags and exceptions propagated from input stream operations · 396145d0
      Louis Dionne authored
      Summary:
      This is a re-application of r357533 and r357531. They had been reverted
      because we thought the commits broke the LLDB data formatters, but it
      turns out this was because only r357531 had been included in the CI
      run.
      
      Before this patch, we would only ever throw an exception if the badbit
      was set on the stream. The Standard is currently very unclear on how
      exceptions should be propagated and what error flags should be set by
      the input stream operations. This commit changes libc++ to behave under
      a different (but valid) interpretation of the Standard. This interpretation
      of the Standard matches what other implementations are doing.
      
      This effectively implements the wording in p1264r0. It hasn't been voted
      into the Standard yet, however there is wide agreement that the fix is
      correct and it's just a matter of time before the fix is standardized.
      
      PR21586
      PR15949
      rdar://problem/15347558
      
      Reviewers: mclow.lists, EricWF
      
      Subscribers: christof, dexonsmith, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D49863
      
      llvm-svn: 357775
      396145d0
    • Stephen Tozer's avatar
      Revert "[llvm-readobj] Improve error message for --string-dump" · bbeca849
      Stephen Tozer authored
      This reverts commit 681b0798.
      
      Reverted due to causing build failures: llvm-svn: 357772
      
      llvm-svn: 357774
      bbeca849
    • Fangrui Song's avatar
      Change some dyn_cast to more apropriate isa. NFC · 2c5c12c0
      Fangrui Song authored
      llvm-svn: 357773
      2c5c12c0
    • Stephen Tozer's avatar
      [llvm-readobj] Improve error message for --string-dump · 681b0798
      Stephen Tozer authored
      Fixes bug 40630: https://bugs.llvm.org/show_bug.cgi?id=40630
      
      This patch changes the error message when the section specified by
      --string-dump cannot be found by including the name of the section in
      the error message and changing the prefix text to not imply that the
      file itself was invalid. As part of this change some uses of
      std::error_code have been replaced with the llvm Error class to better
      encapsulate the error info (rather than passing File strings around),
      and the WithColor class replaces string literal error prefixes.
      
      Differential Revision: https://reviews.llvm.org/D59946
      
      llvm-svn: 357772
      681b0798
  2. Apr 05, 2019
    • Stephen Tozer's avatar
      [format] Add correct punctuation to comment · ed7f8e65
      Stephen Tozer authored
      Test commit that adds a grammatically correct full stop to a single
      comment.
      
      llvm-svn: 357771
      ed7f8e65
    • Sam McCall's avatar
      [Tooling] add a Heuristic field indicating that a CompileCommand was guessed. · 36913e3f
      Sam McCall authored
      Summary:
      Use cases:
       - a tool that dumps the heuristic used for each header in a project can
         be used to evaluate changes to the heuristic
       - we want to expose this information to users in clangd as it affects
         accuracy/reliability of editor features
       - express interpolation tests more directly
      
      Reviewers: ilya-biryukov, klimek
      
      Subscribers: ioeric, kadircet, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D60194
      
      llvm-svn: 357770
      36913e3f
    • Guillaume Chatelet's avatar
      Add an option do not dump the generated object on disk · 848df5b5
      Guillaume Chatelet authored
      Reviewers: courbet
      
      Subscribers: llvm-commits, bdb
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60317
      
      llvm-svn: 357769
      848df5b5
    • Yitzhak Mandelbaum's avatar
      [LibTooling] Add Transformer, a library for source-to-source transformations. · fdd98782
      Yitzhak Mandelbaum authored
      Summary: Adds a basic version of Transformer, a library supporting the concise specification of clang-based source-to-source transformations.  A full discussion of the end goal can be found on the cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling".
      
      Reviewers: ilya-biryukov
      
      Reviewed By: ilya-biryukov
      
      Subscribers: ioeric, ABataev, mgorny, jfb, jdoerfert, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D59376
      
      llvm-svn: 357768
      fdd98782
    • Clement Courbet's avatar
      [ExpandMemCmp][NFC] Add tests for `memcmp(p, q, n) < 0` case. · 1d8c9dfe
      Clement Courbet authored
      llvm-svn: 357767
      1d8c9dfe
    • Simon Pilgrim's avatar
      [SelectionDAG] Add fcmp UNDEF handling to SelectionDAG::FoldSetCC · 17586cda
      Simon Pilgrim authored
      Second half of PR40800, this patch adds DAG undef handling to fcmp instructions to match the behavior in llvm::ConstantFoldCompareInstruction, this permits constant folding of vector comparisons where some elements had been reduced to UNDEF (by SimplifyDemandedVectorElts etc.).
      
      This involves a lot of tweaking to reduced tests as bugpoint loves to reduce fcmp arguments to undef........
      
      Differential Revision: https://reviews.llvm.org/D60006
      
      llvm-svn: 357765
      17586cda
    • Yitzhak Mandelbaum's avatar
      [LibTooling] Add "SourceCode" library for functions relating to source-code manipulation. · 84f2271a
      Yitzhak Mandelbaum authored
      Summary:
      Introduces a utility library in Refactoring/ to collect routines related to
      source-code manipulation.  In this change, we move "extended-range" functions
      from the FixIt library (in clangTooling) to this new library.
      
      We need to use this functionality in Refactoring/ and cannot access it if it
      resides in Tooling/, because that would cause clangToolingRefactor to depend on
      clangTooling, which would be a circular dependency.
      
      Reviewers: ilya-biryukov, ioeric
      
      Reviewed By: ilya-biryukov
      
      Subscribers: mgorny, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D60269
      
      llvm-svn: 357764
      84f2271a
    • Matt Arsenault's avatar
      GlobalISel: Add another overload of buildUnmerge · 106429b4
      Matt Arsenault authored
      It's annoying to have to create an array of the result type,
      particularly when you don't care about the size of the value.
      
      llvm-svn: 357763
      106429b4
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Fix non-power-of-2 select · 4ed6ccab
      Matt Arsenault authored
      llvm-svn: 357762
      4ed6ccab
    • Don Hinton's avatar
      [llvm] Add isa_and_nonnull · 629daef4
      Don Hinton authored
      Summary:
      Add new ``isa_and_nonnull<>`` operator that works just like
      the ``isa<>`` operator, except that it allows for a null pointer as an
      argument (which it then returns false).
      
      Reviewers: lattner, aaron.ballman, greened
      
      Reviewed By: lattner
      
      Subscribers: hubert.reinterpretcast, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60291
      
      llvm-svn: 357761
      629daef4
    • Sanjay Patel's avatar
      [DAGCombiner][x86] scalarize splatted vector FP ops · 50a86527
      Sanjay Patel authored
      There are a variety of vector patterns that may be profitably reduced to a
      scalar op when scalar ops are performed using a subset (typically, the
      first lane) of the vector register file.
      
      For x86, this is true for float/double ops and element 0 because
      insert/extract is just a sub-register rename.
      
      Other targets should likely enable the hook in a similar way.
      
      Differential Revision: https://reviews.llvm.org/D60150
      
      llvm-svn: 357760
      50a86527
    • Petar Jovanovic's avatar
      [TextAPI] Fix off-by-one error in the bit index extraction loop · 2b2f35a4
      Petar Jovanovic authored
      The loop in findNextSetBit() runs one pass more than it should.
      
      On 64-bit architectures this does not cause a problem, but 32-bit
      architectures mask the shift count to 5 bits which limits the number of
      shifts inside a range of 0 to 31. Shifting by 32 has the same effect as
      shifting by 0, so if the first bit in the set is 1, the function will return
      with Index different from EndIndexVal. Because of that, range-based for
      loops iterating thorough architectures will continue until hitting a 0 in
      the set, resulting in n additional iterations, where n is equal to the
      number of consecutive 1 bits at the start the set.
      
      Ultimately TBDv1.WriteFile and TBDv2.WriteFile will output additional
      architectures causing a failure in the unit tests.
      
      Patch by Milos Stojanovic.
      
      Differential Revision: https://reviews.llvm.org/D60198
      
      llvm-svn: 357759
      2b2f35a4
    • Fangrui Song's avatar
      [Symbolize] Replace map<SymbolDesc, StringRef> with sorted vector · afb54fd6
      Fangrui Song authored
      llvm-svn: 357758
      afb54fd6
    • Simon Pilgrim's avatar
      [X86][AVX] Add PR34584 masked store test cases · faa5b939
      Simon Pilgrim authored
      llvm-svn: 357757
      faa5b939
    • Simon Pilgrim's avatar
      [X86] Add SSE/AVX1/AVX2 masked trunc+store tests · 329e63b9
      Simon Pilgrim authored
      llvm-svn: 357756
      329e63b9
    • Pavel Labath's avatar
      modify-python-lldb.py: Insert initialization code with swig instead · 78a514bf
      Pavel Labath authored
      This is the last functional change to the generated python module being
      done by modify-python-lldb.py. The remaining code just deals with
      reformatting of comments.
      
      llvm-svn: 357755
      78a514bf
    • Pavel Labath's avatar
      Fix r357749 for big-endian architectures · ebdc698d
      Pavel Labath authored
      We need to read the strings from the minidump files as little-endian,
      regardless of the host byte order.
      
      I definitely remember thinking about this case while writing the patch
      (and in fact, I have implemented that for the "write" case), but somehow
      I have ended up not implementing the byte swapping when reading the
      data. This adds the necessary byte-swapping and should hopefully fix
      test failures on big-endian bots.
      
      llvm-svn: 357754
      ebdc698d
    • Rainer Orth's avatar
      [Sanitizers] Provide __internal_dup on Solaris · 92db30fc
      Rainer Orth authored
      Both LLVM 8.0.0 and current trunk fail to link libclang_rt.ubsan.standalone-*.so
      on Solaris 11/x86 with GCC 8.1.0:
      
        Undefined			first referenced
         symbol  			    in file
        Scanning dependencies of target clang_rt.asan_cxx-x86_64
        __sanitizer::internal_dup(int)      ../sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_posix.cc.o
        ld: fatal: symbol referencing errors
        collect2: error: ld returned 1 exit status
        make[2]: *** [projects/compiler-rt/lib/ubsan/CMakeFiles/clang_rt.ubsan_standalone-dynamic-i386.dir/build.make:233: lib/clang/9.0.0/lib/sunos/libclang_rt.ubsan_standalone-i386.so] Error 1
      
      Fixed by providing an implementation, which allowed the i386-pc-solaris2.11 build
      to finish.
      
      Differential Revision: https://reviews.llvm.org/D60045
      
      llvm-svn: 357753
      92db30fc
    • Roger Ferrer Ibanez's avatar
      [RISCV] Implement adding a displacement to a BlockAddress · e011e4f8
      Roger Ferrer Ibanez authored
      Recent change rL357393 uses MachineInstrBuilder::addDisp to add a based on a
      BlockAddress but this case was not implemented.
      
      This patch adds the missing case and a test for RISC-V that exercises the new
      case.
      
      Differential Revision: https://reviews.llvm.org/D60136
      
      llvm-svn: 357752
      e011e4f8
    • Rainer Orth's avatar
      [Sanitizers] Fix sanitizer_linux_libcdep.cc compilation on Solaris · a0524521
      Rainer Orth authored
      Both LLVM 8.0.0 and current trunk fail to compile on Solaris 11/x86 with
      GCC 8.1.0:
      
        /vol/llvm/src/llvm/dist/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc: In function ‘void __sanitizer::ReExec()’:
        /vol/llvm/src/llvm/dist/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:831:14: error: ‘getexecname’ was not declared in this scope
           pathname = getexecname();
                      ^~~~~~~~~~~
        /vol/llvm/src/llvm/dist/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:831:14: note: suggested alternative: ‘gethostname’
           pathname = getexecname();
                      ^~~~~~~~~~~
                      gethostname
      
      This is easily fixed by including <stdlib.h> which declares that function.
      With that patch, compilation continues.
      
      Differential Revision: https://reviews.llvm.org/D60044
      
      llvm-svn: 357751
      a0524521
    • Pavel Labath's avatar
      Fix MSVC build for r357749 · 4a6dd1e6
      Pavel Labath authored
      MSVC found the bare "make_unique" invocation ambiguous (between std::
      and llvm:: versions). Explicitly qualifying the call with llvm:: should
      hopefully fix it.
      
      llvm-svn: 357750
      4a6dd1e6
    • Pavel Labath's avatar
      Minidump: Add support for reading/writing strings · 51d9fa0a
      Pavel Labath authored
      Summary:
      Strings in minidump files are stored as a 32-bit length field, giving
      the length of the string in *bytes*, which is followed by the
      appropriate number of UTF16 code units. The string is also supposed to
      be null-terminated, and the null-terminator is not a part of the length
      field. This patch:
      - adds support for reading these strings out of the minidump file (this
        implementation does not depend on proper null-termination)
      - adds support for writing them to a minidump file
      - using the previous two pieces implements proper (de)serialization of
        the CSDVersion field of the SystemInfo stream. Previously, this was
        only read/written as hex, and no attempt was made to access the
        referenced string -- now this string is read and written correctly.
      
      The changes are tested via yaml2obj|obj2yaml round-trip as well as a
      unit test which checks the corner cases of the string deserialization
      logic.
      
      Reviewers: jhenderson, zturner, clayborg
      
      Subscribers: llvm-commits, aprantl, markmentovai, amccarth, lldb-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D59775
      
      llvm-svn: 357749
      51d9fa0a
    • Pavel Labath's avatar
      MinidumpParser: use minidump parser in llvm/Object · 98edcd9b
      Pavel Labath authored
      This patch removes the lower layers of the minidump parsing code from
      the MinidumpParser class, and replaces it with the minidump parser in
      llvm.
      
      Not all functionality is already avaiable in the llvm class, but it is
      enough for us to be able to stop enumerating streams manually, and rely
      on the minidump directory parsing code from the llvm class.
      
      This also removes some checked-in binaries which were used to test error
      handling in the parser, as the error handling is now done (and tested)
      in llvm. Instead I just add one test that ensures we correctly propagate
      the errors reported by the llvm parser. The input for this test can be
      written in yaml instead of a checked-in binary.
      
      llvm-svn: 357748
      98edcd9b
    • Pavel Labath's avatar
      TestVCCode_step: replace assertTrue with more specific assertions · 546bccf6
      Pavel Labath authored
      When this test fails (flakes) all we get is an error message like "False
      is not True". This replaces patterns like assertTrue(a == b) with
      assertEqual(a, b), so we get a better error message (and hopefully a
      hint as to why the test is flaky).
      
      llvm-svn: 357747
      546bccf6
    • Piotr Sobczak's avatar
      [SelectionDAG] Compute known bits of CopyFromReg · 0376ac1d
      Piotr Sobczak authored
      Summary:
      Teach SelectionDAG how to compute known bits of ISD::CopyFromReg if
      the virtual reg used has one def only.
      
      This can be particularly useful when calling isBaseWithConstantOffset()
      with the ISD::CopyFromReg argument, as more optimizations may get enabled
      in the result.
      
      Also add a missing truncation on X86, found by testing of this patch.
      
      Change-Id: Id1c9fceec862d118c54a5b53adf72ada5d6daefa
      
      Reviewers: bogner, craig.topper, RKSimon
      
      Reviewed By: RKSimon
      
      Subscribers: lebedev.ri, nemanjai, jvesely, nhaehnle, javed.absar, jsji, jdoerfert, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D59535
      
      llvm-svn: 357745
      0376ac1d
    • Pavel Labath's avatar
      PDBFPO: Use references instead of pointers, where possible · 94cd0667
      Pavel Labath authored
      Summary:
      The code was passing pointers around, expecting they would be not null.
      In c++ it is possible to convey this notion explicitly by using a
      reference instead.
      
      Not all uses of pointers could be converted to references (e.g. one
      can't store references in a container), but this will at least make it
      locally obvious that code is dealing with nonnull pointers.
      
      Reviewers: aleksandr.urakov, amccarth
      
      Subscribers: lldb-commits
      
      Differential Revision: https://reviews.llvm.org/D60271
      
      llvm-svn: 357744
      94cd0667
    • Craig Topper's avatar
      [X86] Promote i16 SRA instructions to i32 · 94f1772b
      Craig Topper authored
      We already promote SRL and SHL to i32.
      
      This will introduce sign extends sometimes which might be harder to deal with than the zero we use for promoting SRL. I ran this through some of our internal benchmark lists and didn't see any major regressions.
      
      I think there might be some DAG combine improvement opportunities in the test changes here.
      
      Differential Revision: https://reviews.llvm.org/D60278
      
      llvm-svn: 357743
      94f1772b
    • Serguei Katkov's avatar
      [FastISel] Fix crash for gc.relocate lowring · c39636cc
      Serguei Katkov authored
      Lowering safepoint checks that all gc.relocaes observed in safepoint
      must be lowered. However Fast-Isel is able to skip dead gc.relocate.
      
      To resolve this issue we just ignore dead gc.relocate in the check.
      
      Reviewers: reames
      Reviewed By: reames
      Subscribers: llvm-commits
      Differential Revision: https://reviews.llvm.org/D60184
      
      llvm-svn: 357742
      c39636cc