1. Oct 10, 2019
    • David Green's avatar
      [ARM] VQADD instructions · 39596ec2
      David Green authored
      This selects MVE VQADD from the vector llvm.sadd.sat or llvm.uadd.sat
      intrinsics.
      
      Differential Revision: https://reviews.llvm.org/D68566
      
      llvm-svn: 374336
      39596ec2
    • Raphael Isemann's avatar
      [lldb] Make sure import-std-module/sysroot actually passes for the right reasons · f5b2b760
      Raphael Isemann authored
      This test was previously passing because myabs was actually emitted into the
      debug information and we called that. The test itself was broken as it didn't
      use the libc++ directory structure (the /v1/ directory was just called /include/).
      
      This patch gives myabs a default argument which we can't get from debug information
      and inlines the function to make sure we can't call it from LLDB without loading
      the C++ module.
      
      llvm-svn: 374335
      f5b2b760
    • Sanjay Patel's avatar
      [AArch64][x86] add tests for (v)select bit magic; NFC · 3370d4d2
      Sanjay Patel authored
      llvm-svn: 374334
      3370d4d2
    • David Carlier's avatar
      [Sanitizers] Fix getrandom test · 69c9c223
      David Carlier authored
      llvm-svn: 374333
      69c9c223
    • Rui Ueyama's avatar
      Make nullptr check more robust · 9adea6e4
      Rui Ueyama authored
      The only condition that isecLoc becomes null is
      
        Out::bufferStart == nullptr,
        isec->getParent()->offset == 0, and
        isec->outSecOff == 0.
      
      We can check the first condition only once.
      
      llvm-svn: 374332
      9adea6e4
    • Pavel Labath's avatar
      File: Handle more cases in GetOptionsFromMode · 342b1b2e
      Pavel Labath authored
      The "b" (binary) flag is meaningless most of the time, but the relevant
      standars allow it. The standards permit one to spell it both as "r+b"
      and "rb+", so handle both cases.
      
      This fixes TestFileHandle.test_binary_inout with python2.
      
      llvm-svn: 374331
      342b1b2e
    • Guillaume Chatelet's avatar
      [Alignment][NFC] Make VectorUtils uas llvm::Align · 837a1b84
      Guillaume Chatelet authored
      Summary:
      This is patch is part of a series to introduce an Alignment type.
      See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
      See this patch for the introduction of the type: https://reviews.llvm.org/D64790
      
      Reviewers: courbet
      
      Subscribers: hiraditya, rogfer01, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D68784
      
      llvm-svn: 374330
      837a1b84
    • Roman Lebedev's avatar
      [lld] getErrPlace(): don't perform arithmetics on maybe-null pointer · 1508fbad
      Roman Lebedev authored
      isecLoc there can be null, but at the same time isec->getSize() may
      be non-null. It is UB to offset a nullptr.The most straight-forward fix
      here appears to perform casts+normal integral arithmetics.
      
      FAIL: lld :: ELF/invalid/invalid-relocation-aarch64.test (1158 of 2217)
      ******************** TEST 'lld :: ELF/invalid/invalid-relocation-aarch64.test' FAILED ********************
      Script:
      --
      : 'RUN: at line 2';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/yaml2obj /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-aarch64.test -o /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-aarch64.test.tmp.o
      : 'RUN: at line 3';   not /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/ld.lld /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-aarch64.test.tmp.o -o /dev/null 2>&1 | /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/FileCheck /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-aarch64.test
      --
      Exit Code: 1
      
      Command Output (stderr):
      --
      /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-aarch64.test:4:10: error: CHECK: expected string not found in input
      # CHECK: error: unknown relocation (1024) against symbol foo
               ^
      <stdin>:1:1: note: scanning from here
      /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/ELF/Target.cpp:100:41: runtime error: applying non-zero offset 24 to null pointer
      ^
      <stdin>:1:118: note: possible intended match here
      /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/ELF/Target.cpp:100:41: runtime error: applying non-zero offset 24 to null pointer
                                                                                                                           ^
      
      --
      
      ********************
      Testing:  0.. 10.. 20.. 30.. 40.. 50.
      FAIL: lld :: ELF/invalid/invalid-relocation-x64.test (1270 of 2217)
      ******************** TEST 'lld :: ELF/invalid/invalid-relocation-x64.test' FAILED ********************
      Script:
      --
      : 'RUN: at line 2';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/yaml2obj /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-x64.test -o /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp1.o
      : 'RUN: at line 3';   echo ".global foo; foo:" > /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp2.s
      : 'RUN: at line 4';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/llvm-mc /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp2.s -o /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp2.o -filetype=obj -triple x86_64-pc-linux
      : 'RUN: at line 5';   not /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/ld.lld /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp1.o /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp2.o -o /dev/null 2>&1 | /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/FileCheck /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-x64.test
      --
      Exit Code: 1
      
      Command Output (stderr):
      --
      /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-x64.test:6:10: error: CHECK: expected string not found in input
      # CHECK: error: unknown relocation (152) against symbol foo
               ^
      <stdin>:1:1: note: scanning from here
      /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/ELF/Target.cpp:100:41: runtime error: applying non-zero offset 24 to null pointer
      ^
      <stdin>:1:118: note: possible intended match here
      /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/ELF/Target.cpp:100:41: runtime error: applying non-zero offset 24 to null pointer
                                                                                                                           ^
      
      --
      
      ********************
      Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
      Testing Time: 20.73s
      ********************
      Failing Tests (2):
          lld :: ELF/invalid/invalid-relocation-aarch64.test
          lld :: ELF/invalid/invalid-relocation-x64.test
      
      llvm-svn: 374329
      1508fbad
    • Roman Lebedev's avatar
      [AST] ASTReader::ReadSLocEntry(): move computation of FirstDecl into the branch where it's used · bf4f1e0e
      Roman Lebedev authored
      The existing code is not defined, you are not allowed
      to produce non-null pointer from null pointer (F->FileSortedDecls here).
      That being said, i'm not really confident this is fix-enough, but we'll see.
      
      FAIL: Clang :: Modules/no-module-map.cpp (6879 of 16079)
      ******************** TEST 'Clang :: Modules/no-module-map.cpp' FAILED ********************
      Script:
      --
      : 'RUN: at line 1';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/clang -cc1 -internal-isystem /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/lib/clang/10.0.0/include -nostdsysteminc -fmodules-ts -fmodule-name=ab -x c++-header /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/test/Modules/Inputs/no-module-map/a.h /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/test/Modules/Inputs/no-module-map/b.h -emit-header-module -o /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/clang/test/Modules/Output/no-module-map.cpp.tmp.pcm
      : 'RUN: at line 2';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/clang -cc1 -internal-isystem /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/lib/clang/10.0.0/include -nostdsysteminc -fmodules-ts -fmodule-file=/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/clang/test/Modules/Output/no-module-map.cpp.tmp.pcm /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/test/Modules/no-module-map.cpp -I/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/test/Modules/Inputs/no-module-map -verify
      : 'RUN: at line 3';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/clang -cc1 -internal-isystem /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/lib/clang/10.0.0/include -nostdsysteminc -fmodules-ts -fmodule-file=/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/clang/test/Modules/Output/no-module-map.cpp.tmp.pcm /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/test/Modules/no-module-map.cpp -I/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/test/Modules/Inputs/no-module-map -verify -DA
      : 'RUN: at line 4';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/clang -cc1 -internal-isystem /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/lib/clang/10.0.0/include -nostdsysteminc -fmodules-ts -fmodule-file=/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/clang/test/Modules/Output/no-module-map.cpp.tmp.pcm /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/test/Modules/no-module-map.cpp -I/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/test/Modules/Inputs/no-module-map -verify -DB
      : 'RUN: at line 5';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/clang -cc1 -internal-isystem /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/lib/clang/10.0.0/include -nostdsysteminc -fmodules-ts -fmodule-file=/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/clang/test/Modules/Output/no-module-map.cpp.tmp.pcm /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/test/Modules/no-module-map.cpp -I/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/test/Modules/Inputs/no-module-map -verify -DA -DB
      : 'RUN: at line 7';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/clang -cc1 -internal-isystem /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/lib/clang/10.0.0/include -nostdsysteminc -E /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/clang/test/Modules/Output/no-module-map.cpp.tmp.pcm -o - | /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/FileCheck /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/test/Modules/no-module-map.cpp
      : 'RUN: at line 8';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/clang -cc1 -internal-isystem /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/lib/clang/10.0.0/include -nostdsysteminc -frewrite-imports -E /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/clang/test/Modules/Output/no-module-map.cpp.tmp.pcm -o - | /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/FileCheck /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/test/Modules/no-module-map.cpp
      --
      Exit Code: 2
      
      Command Output (stderr):
      --
      /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Serialization/ASTReader.cpp:1526:50: runtime error: applying non-zero offset 8 to null pointer
          #0 0x3a9bd0c in clang::ASTReader::ReadSLocEntry(int) /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Serialization/ASTReader.cpp:1526:50
          #1 0x328b6f8 in clang::SourceManager::loadSLocEntry(unsigned int, bool*) const /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Basic/SourceManager.cpp:461:28
          #2 0x328b351 in clang::SourceManager::initializeForReplay(clang::SourceManager const&) /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Basic/SourceManager.cpp:399:11
          #3 0x3996c71 in clang::FrontendAction::BeginSourceFile(clang::CompilerInstance&, clang::FrontendInputFile const&) /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Frontend/FrontendAction.cpp:581:27
          #4 0x394f341 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:956:13
          #5 0x3a8a92b in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:290:25
          #6 0xaf8d62 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/tools/driver/cc1_main.cpp:250:15
          #7 0xaf1602 in ExecuteCC1Tool /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/tools/driver/driver.cpp:309:12
          #8 0xaf1602 in main /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/tools/driver/driver.cpp:382:12
          #9 0x7f2c1eecc2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
          #10 0xad57f9 in _start (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/clang-10+0xad57f9)
      
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Serialization/ASTReader.cpp:1526:50 in
      llvm-svn: 374328
      bf4f1e0e
    • Roman Lebedev's avatar
      [ADR] ArrayRefTest: disable SizeTSizedOperations test - it's UB. · abb34df4
      Roman Lebedev authored
      This test is not defined.
      
      FAIL: LLVM-Unit :: ADT/./ADTTests/ArrayRefTest.SizeTSizedOperations (178 of 33926)
      ******************** TEST 'LLVM-Unit :: ADT/./ADTTests/ArrayRefTest.SizeTSizedOperations' FAILED ********************
      Note: Google Test filter = ArrayRefTest.SizeTSizedOperations
      [==========] Running 1 test from 1 test case.
      [----------] Global test environment set-up.
      [----------] 1 test from ArrayRefTest
      [ RUN      ] ArrayRefTest.SizeTSizedOperations
      /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:180:32: runtime error: applying non-zero offset 9223372036854775806 to null pointer
          #0 0x5ae8dc in llvm::ArrayRef<char>::slice(unsigned long, unsigned long) const /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:180:32
          #1 0x5ae44c in (anonymous namespace)::ArrayRefTest_SizeTSizedOperations_Test::TestBody() /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/unittests/ADT/ArrayRefTest.cpp:85:3
          #2 0x928a96 in testing::Test::Run() /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2474:5
          #3 0x929793 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
          #4 0x92a152 in testing::TestCase::Run() /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
          #5 0x9319d2 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
          #6 0x931416 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:4257:10
          #7 0x920ac3 in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
          #8 0x920ac3 in main /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50:10
          #9 0x7f66135b72e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
          #10 0x472c19 in _start (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/unittests/ADT/ADTTests+0x472c19)
      
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:180:32 in
      llvm-svn: 374327
      abb34df4
    • Simon Pilgrim's avatar
      Fix -Wparentheses warning. NFCI. · 788ba151
      Simon Pilgrim authored
      llvm-svn: 374326
      788ba151
    • Aleksandr Urakov's avatar
      [Windows] Introduce a switch for the `lldb-server` mode on Windows · 08913665
      Aleksandr Urakov authored
      Summary:
      This patch introduces a switch, based on the environment variable
      `LLDB_USE_LLDB_SERVER`, to determine whether to use the `ProcessWindows` plugin
      (the old way) or the `lldb-server` way for debugging on Windows.
      
      Reviewers: labath, amccarth, asmith, stella.stamenova
      
      Reviewed By: labath, amccarth
      
      Subscribers: mstorsjo, abidh, JDevlieghere, lldb-commits, leonid.mashinskiy
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D68258
      
      llvm-svn: 374325
      08913665
    • Kadir Cetinkaya's avatar
      Revert "Use -fdebug-compilation-dir to form absolute paths in coverage mappings" · 62808631
      Kadir Cetinkaya authored
      This reverts commit f6777964.
      
      Because the absolute path check relies on temporary path containing
      "clang", "test" and "CoverageMapping" as a subsequence, which is not
      necessarily true on all systems(breaks internal integrates). Wanted to
      fix it by checking for a leading "/" instead, but then noticed that it
      would break windows tests, so leaving it to the author instead.
      
      llvm-svn: 374324
      62808631
    • Pavel Labath's avatar
      TestFileHandle.py: relax exception type checks · 44506cd7
      Pavel Labath authored
      the exceptions returned differ between swig4 (TypeError) and swig<=3
      (NotImplementedError). Just check for the base Exception class instead.
      
      Theoretically we could switch on the swig version and expect the precise
      type directly, but checking the exact type does not seem that important.
      
      Thanks to Raphael for helping me figure this out.
      
      llvm-svn: 374322
      44506cd7
    • Russell Gallop's avatar
      Fix sanitizer lint check after r374315 · 38ac46b4
      Russell Gallop authored
      llvm-svn: 374321
      38ac46b4
    • Mirko Brkusanin's avatar
      [Mips] Fix 374055 · c2e48167
      Mirko Brkusanin authored
      EXPENSIVE_CHECKS build was failing on new test.
      This is fixed by marking $ra register as undef.
      Test now has -verify-machineinstrs to check for operand flags.
      
      llvm-svn: 374320
      c2e48167
    • Thomas Preud'homme's avatar
      [test] Use system locale for mri-utf8.test · b6f1d1fa
      Thomas Preud'homme authored
      Summary:
      llvm-ar's mri-utf8.test test relies on the en_US.UTF-8 locale to be
      installed for its last RUN line to work. If not installed, the unicode
      string gets encoded (interpreted) as ascii which fails since the most
      significant byte is non zero. This commit changes the test to only rely
      on the system being able to encode the pound sign in its default
      encoding (e.g. UTF-16 for Microsoft Windows) by always opening the file
      via input/output redirection. This avoids forcing a given locale to be
      present and supported. A Byte Order Mark is also added to help
      recognizing the encoding of the file and its endianness.
      
      Reviewers: gbreynoo, MaskRay, rupprecht, JamesNagurne, jfb
      
      Subscribers: dexonsmith, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D68472
      
      llvm-svn: 374318
      b6f1d1fa
    • Roman Lebedev's avatar
      [UBSan] Appease linter · 6430adbe
      Roman Lebedev authored
      llvm-svn: 374316
      6430adbe
    • David Carlier's avatar
      [Sanitizers] Porting getrandom/getentropy interceptors to FreeBSD · 90c8b59c
      David Carlier authored
      - Available from 12.x branch, by the time it lands next year in FreeBSD tree, the 11.x's might be EOL.
      - Intentionally changed the getrandom test to C code as with 12.0 (might be fixed in CURRENT since), there is a linkage issue in C++ context.
      
      Reviewers: emaste, dim, vitalybuka
      
      Reviewed-By: vitalybuka
      
      Differential Revision: https://reviews.llvm.org/D68451
      
      llvm-svn: 374315
      90c8b59c
    • Fangrui Song's avatar
      [COFF] Wrap definitions in namespace lld { namespace coff {. NFC · d79c3be6
      Fangrui Song authored
      Similar to D67323, but for COFF. Many lld/COFF/ files already use
      `namespace lld { namespace coff {`. Only a few need changing.
      
      Reviewed By: ruiu
      
      Differential Revision: https://reviews.llvm.org/D68772
      
      llvm-svn: 374314
      d79c3be6
    • Raphael Isemann's avatar
      [lldb][NFC] Remove strange bool parameter from Searcher::SearchCallback · 95e264fc
      Raphael Isemann authored
      Summary:
      The SearchCallback has a bool parameter that we always set to false, we never use in any callback implementation and that also changes its name
      from one file to the other (either `containing` and `complete`). It was added in the original LLDB check in, so there isn't any history what
      this was supposed to be, so let's just remove it.
      
      Reviewers: jingham, JDevlieghere, labath
      
      Reviewed By: jingham, labath
      
      Subscribers: lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D68696
      
      llvm-svn: 374313
      95e264fc
    • Raphael Isemann's avatar
      [lldb] Fix out of bounds read in DataExtractor::GetCStr and add unit test that function. · 067bb1f5
      Raphael Isemann authored
      Summary:
      The `if (*cstr_end == '\0')` in the previous code checked if the previous loop terminated because it
      found a null terminator or because it reached the end of the data. However, in the case that we hit
      the end of the data before finding a null terminator, `cstr_end` points behind the last byte in our
      data and `*cstr_end` reads the memory behind the array (which may be uninitialised)
      
      This patch just rewrites that function use `std::find` and adds the relevant unit tests.
      
      Reviewers: labath
      
      Reviewed By: labath
      
      Subscribers: abidh, JDevlieghere, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D68773
      
      llvm-svn: 374311
      067bb1f5
    • Roman Lebedev's avatar
      eb8b6fe7
    • Russell Gallop's avatar
      Revert "[ASan] Do not misrepresent high value address dereferences as null dereferences" · c48e0873
      Russell Gallop authored
      As it was breaking bots running sanitizer lint check
      
      This reverts r374265 (git b577efe4)
      
      llvm-svn: 374308
      c48e0873
    • Raphael Isemann's avatar
      186f1c58
    • Roman Lebedev's avatar
      [UBSan] Split nullptr-and-nonzero-offset-variable.cpp into C and C++ variants · 5d59f20c
      Roman Lebedev authored
      I do not understand the BB failire, it fully passes locally.
      
      llvm-svn: 374306
      5d59f20c
    • Oliver Stannard's avatar
      [IfCvt][ARM] Optimise diamond if-conversion for code size · 4f454b22
      Oliver Stannard authored
      Currently, the heuristics the if-conversion pass uses for diamond if-conversion
      are based on execution time, with no consideration for code size. This adds a
      new set of heuristics to be used when optimising for code size.
      
      This is mostly target-independent, because the if-conversion pass can
      see the code size of the instructions which it is removing. For thumb,
      there are a few passes (insertion of IT instructions, selection of
      narrow branches, and selection of CBZ instructions) which are run after
      if conversion and affect these heuristics, so I've added target hooks to
      better predict the code-size effect of a proposed if-conversion.
      
      Differential revision: https://reviews.llvm.org/D67350
      
      llvm-svn: 374301
      4f454b22
    • Pavel Labath's avatar
      s/@expectedFailure/@expectedFailureAll in TestFileHandle · c92a75fe
      Pavel Labath authored
      The test isn't using @expectedFailure correctly, which causes weird
      errors, at least with python2, at least with linux. Possibly that
      function shouldn't even be public as it's main use is as a backed for
      other decorators.
      
      llvm-svn: 374299
      c92a75fe
    • Roman Lebedev's avatar
      [UBSan] Revisit nullptr-and-nonzero-offset-variable.cpp test to hopefully make... · 3de28b83
      Roman Lebedev authored
      [UBSan] Revisit nullptr-and-nonzero-offset-variable.cpp test to hopefully make it pass on sanitizer-windows BB
      
      llvm-svn: 374298
      3de28b83
    • Rui Ueyama's avatar
      Use error instead of fatal to report usage errors · 37bf9bb4
      Rui Ueyama authored
      Differential Revision: https://reviews.llvm.org/D68768
      
      llvm-svn: 374297
      37bf9bb4
    • Russell Gallop's avatar
      Remove rest of time-trace message as it is inconsistent style · 9d9ac46a
      Russell Gallop authored
      Other options which create output files don't produce output messages.
      Improve documentation to help find trace file.
      
      Differential Revision: https://reviews.llvm.org/D68710
      
      llvm-svn: 374294
      9d9ac46a
    • Roman Lebedev's avatar
      [UBSan][clang][compiler-rt] Applying non-zero offset to nullptr is undefined behaviour · 536b0ee4
      Roman Lebedev authored
      Summary:
      Quote from http://eel.is/c++draft/expr.add#4:
      ```
      4     When an expression J that has integral type is added to or subtracted
            from an expression P of pointer type, the result has the type of P.
      (4.1) If P evaluates to a null pointer value and J evaluates to 0,
            the result is a null pointer value.
      (4.2) Otherwise, if P points to an array element i of an array object x with n
            elements ([dcl.array]), the expressions P + J and J + P
            (where J has the value j) point to the (possibly-hypothetical) array
            element i+j of x if 0≤i+j≤n and the expression P - J points to the
            (possibly-hypothetical) array element i−j of x if 0≤i−j≤n.
      (4.3) Otherwise, the behavior is undefined.
      ```
      
      Therefore, as per the standard, applying non-zero offset to `nullptr`
      (or making non-`nullptr` a `nullptr`, by subtracting pointer's integral value
      from the pointer itself) is undefined behavior. (*if* `nullptr` is not defined,
      i.e. e.g. `-fno-delete-null-pointer-checks` was *not* specified.)
      
      To make things more fun, in C (6.5.6p8), applying *any* offset to null pointer
      is undefined, although Clang front-end pessimizes the code by not lowering
      that info, so this UB is "harmless".
      
      Since rL369789 (D66608 `[InstCombine] icmp eq/ne (gep inbounds P, Idx..), null -> icmp eq/ne P, null`)
      LLVM middle-end uses those guarantees for transformations.
      If the source contains such UB's, said code may now be miscompiled.
      Such miscompilations were already observed:
      * https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190826/687838.html
      * https://github.com/google/filament/pull/1566
      
      Surprisingly, UBSan does not catch those issues
      ... until now. This diff teaches UBSan about these UB's.
      
      `getelementpointer inbounds` is a pretty frequent instruction,
      so this does have a measurable impact on performance;
      I've addressed most of the obvious missing folds (and thus decreased the performance impact by ~5%),
      and then re-performed some performance measurements using my [[ https://github.com/darktable-org/rawspeed | RawSpeed ]] benchmark:
      (all measurements done with LLVM ToT, the sanitizer never fired.)
      * no sanitization vs. existing check: average `+21.62%` slowdown
      * existing check vs. check after this patch: average `22.04%` slowdown
      * no sanitization vs. this patch: average `48.42%` slowdown
      
      Reviewers: vsk, filcab, rsmith, aaron.ballman, vitalybuka, rjmccall, #sanitizers
      
      Reviewed By: rsmith
      
      Subscribers: kristof.beyls, nickdesaulniers, nikic, ychen, dtzWill, xbolva00, dberris, arphaman, rupprecht, reames, regehr, llvm-commits, cfe-commits
      
      Tags: #clang, #sanitizers, #llvm
      
      Differential Revision: https://reviews.llvm.org/D67122
      
      llvm-svn: 374293
      536b0ee4
    • Martin Storsjo's avatar
      [LLD] [MinGW] Look for other library patterns with -l · 0226c352
      Martin Storsjo authored
      GNU ld looks for a number of other patterns than just lib<name>.dll.a
      and lib<name>.a.
      
      GNU ld does support linking directly against a DLL without using an
      import library. If that's the only match for a -l argument, point out
      that the user needs to use an import library, instead of leaving the
      user with a puzzling message about the -l argument not being found
      at all.
      
      Also convert an existing case of fatal() into error().
      
      Differential Revision: https://reviews.llvm.org/D68689
      
      llvm-svn: 374292
      0226c352
    • Martin Storsjo's avatar
      [LLD] [MinGW] Add a testcase for -l:name style library options. NFC. · e742794f
      Martin Storsjo authored
      Differential Revision: https://reviews.llvm.org/D68688
      
      llvm-svn: 374291
      e742794f
    • Rui Ueyama's avatar
      Improve error message for bad SHF_MERGE sections · d7ead5b5
      Rui Ueyama authored
      This patch adds a section name to error messages.
      
      Differential Revision: https://reviews.llvm.org/D68758
      
      llvm-svn: 374290
      d7ead5b5
    • Raphael Isemann's avatar
      7c47b4a1
    • Sjoerd Meijer's avatar
      Recommit "[Clang] Pragma vectorize_width() implies vectorize(enable)" · 80371c74
      Sjoerd Meijer authored
      This was further discussed at the llvm dev list:
      
      http://lists.llvm.org/pipermail/llvm-dev/2019-October/135602.html
      
      I think the brief summary of that is that this change is an improvement,
      this is the behaviour that we expect and promise in ours docs, and also
      as a result there are cases where we now emit diagnostics whereas before
      pragmas were silently ignored. Two areas where we can improve: 1) the
      diagnostic message itself, and 2) and in some cases (e.g. -Os and -Oz)
      the vectoriser is (quite understandably) not triggering.
      
      Original commit message:
      
      Specifying the vectorization width was supposed to implicitly enable
      vectorization, except that it wasn't really doing this. It was only
      setting the vectorize.width metadata, but not vectorize.enable.
      
      This should fix PR27643.
      
      llvm-svn: 374288
      80371c74
    • Simon Tatham's avatar
      [update_cc_test_checks] Support 'clang | opt | FileCheck' · 109c773a
      Simon Tatham authored
      Some clang lit tests use a pipeline of the form
      
      // RUN: %clang [args] -O0 %s | opt [specific optimizations] | FileCheck %s
      
      to make the expected test output depend on as few optimization phases
      as possible, for stability. But when you write a RUN line of this
      form, you lose the ability to use update_cc_test_checks.py to
      automatically generate the expected output, because it only supports
      two-stage pipelines consisting of '%clang | FileCheck' (or %clang_cc1).
      
      This change extends the set of supported RUN lines so that pipelines
      with an invocation of `opt` in the middle can still be automatically
      handled.
      
      To implement it, I've adjusted `get_function_body()` so that it can
      cope with an arbitrary sequence of intermediate pipeline commands. But
      the code that decides which RUN lines to consider is more
      conservative: it only adds clang | opt | FileCheck to the set of
      supported lines, because I didn't want to accidentally include some
      other kind of line that doesn't output IR at all.
      
      (Also in this commit is the minimal change to make this script work at
      all, after r373912 added an extra parameter to `add_ir_checks`.)
      
      Reviewers: MaskRay, xbolva00
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D68406
      
      llvm-svn: 374287
      109c773a
    • Gauthier Harnisch's avatar
      [clang] prevent crash for nonnull attribut in constant context (Bug 43601) · 59c6df9b
      Gauthier Harnisch authored
      Summary:
      
      bug : https://bugs.llvm.org/show_bug.cgi?id=43601
      
      Reviewers: rnk
      
      Reviewed By: rnk
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D68716
      
      llvm-svn: 374285
      59c6df9b
    • Matt Arsenault's avatar
      AMDGPU: Use SGPR_128 instead of SReg_128 for vregs · 12994a70
      Matt Arsenault authored
      SGPR_128 only includes the real allocatable SGPRs, and SReg_128 adds
      the additional non-allocatable TTMP registers. There's no point in
      allocating SReg_128 vregs. This shrinks the size of the classes
      regalloc needs to consider, which is usually good.
      
      llvm-svn: 374284
      12994a70