platform/upstream/llvm.git
5 years ago[DAGCombine] Match more patterns for half word bswap
Amaury Sechet [Thu, 10 Oct 2019 13:20:10 +0000 (13:20 +0000)]
[DAGCombine] Match more patterns for half word bswap

Summary: It ensures that the bswap is generated even when a part of the subtree already matches a bswap transform.

Reviewers: craig.topper, efriedma, RKSimon, lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68250

llvm-svn: 374340

5 years ago[FileCheck] Implement --ignore-case option.
Kai Nacke [Thu, 10 Oct 2019 13:15:41 +0000 (13:15 +0000)]
[FileCheck] Implement --ignore-case option.

The FileCheck utility is enhanced to support a `--ignore-case`
option. This is useful in cases where the output of Unix tools
differs in case (e.g. case not specified by Posix).

Reviewers: Bigcheese, jakehehrlich, rupprecht, espindola, alexshap, jhenderson, MaskRay

Differential Revision: https://reviews.llvm.org/D68146

llvm-svn: 374339

5 years ago[LV][NFC] Factor out calculation of "best" estimated trip count.
Florian Hahn [Thu, 10 Oct 2019 13:07:01 +0000 (13:07 +0000)]
[LV][NFC] Factor out calculation of "best" estimated trip count.

This is just small refactoring to minimize changes in upcoming patch.
In the next path I'm going to introduce changes into heuristic for vectorization of "tiny trip count" loops.

Patch by Evgeniy Brevnov <evgueni.brevnov@gmail.com>

Reviewers: hsaito, Ayal, fhahn, reames

Reviewed By: hsaito

Differential Revision: https://reviews.llvm.org/D67690

llvm-svn: 374338

5 years agoMinidumpYAML: Add support for the memory info list stream
Pavel Labath [Thu, 10 Oct 2019 13:05:46 +0000 (13:05 +0000)]
MinidumpYAML: Add support for the memory info list stream

Summary:
The implementation is fairly straight-forward and uses the same patterns
as the existing streams. The yaml form does not attempt to preserve the
data in the "gaps" that can be created by setting a larger-than-required
header or entry size in the stream header, because the existing consumer
(lldb) does not make use of the information in the gap in any way, and
attempting to preserve that would make the implementation more
complicated.

Reviewers: amccarth, jhenderson, clayborg

Subscribers: llvm-commits, lldb-commits, markmentovai, zturner, JosephTremoulet

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68645

llvm-svn: 374337

5 years ago[ARM] VQADD instructions
David Green [Thu, 10 Oct 2019 13:05:04 +0000 (13:05 +0000)]
[ARM] VQADD instructions

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

5 years ago[lldb] Make sure import-std-module/sysroot actually passes for the right reasons
Raphael Isemann [Thu, 10 Oct 2019 12:57:14 +0000 (12:57 +0000)]
[lldb] Make sure import-std-module/sysroot actually passes for the right reasons

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

5 years ago[AArch64][x86] add tests for (v)select bit magic; NFC
Sanjay Patel [Thu, 10 Oct 2019 12:53:24 +0000 (12:53 +0000)]
[AArch64][x86] add tests for (v)select bit magic; NFC

llvm-svn: 374334

5 years ago[Sanitizers] Fix getrandom test
David Carlier [Thu, 10 Oct 2019 12:48:18 +0000 (12:48 +0000)]
[Sanitizers] Fix getrandom test

llvm-svn: 374333

5 years agoMake nullptr check more robust
Rui Ueyama [Thu, 10 Oct 2019 12:41:08 +0000 (12:41 +0000)]
Make nullptr check more robust

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

5 years agoFile: Handle more cases in GetOptionsFromMode
Pavel Labath [Thu, 10 Oct 2019 12:40:27 +0000 (12:40 +0000)]
File: Handle more cases in GetOptionsFromMode

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

5 years ago[Alignment][NFC] Make VectorUtils uas llvm::Align
Guillaume Chatelet [Thu, 10 Oct 2019 12:35:04 +0000 (12:35 +0000)]
[Alignment][NFC] Make VectorUtils uas llvm::Align

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

5 years ago[lld] getErrPlace(): don't perform arithmetics on maybe-null pointer
Roman Lebedev [Thu, 10 Oct 2019 12:22:55 +0000 (12:22 +0000)]
[lld] getErrPlace(): don't perform arithmetics on maybe-null pointer

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

5 years ago[AST] ASTReader::ReadSLocEntry(): move computation of FirstDecl into the branch where...
Roman Lebedev [Thu, 10 Oct 2019 12:22:42 +0000 (12:22 +0000)]
[AST] ASTReader::ReadSLocEntry(): move computation of FirstDecl into the branch where it's used

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

5 years ago[ADR] ArrayRefTest: disable SizeTSizedOperations test - it's UB.
Roman Lebedev [Thu, 10 Oct 2019 12:22:33 +0000 (12:22 +0000)]
[ADR] ArrayRefTest: disable SizeTSizedOperations test - it's UB.

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

5 years agoFix -Wparentheses warning. NFCI.
Simon Pilgrim [Thu, 10 Oct 2019 12:21:52 +0000 (12:21 +0000)]
Fix -Wparentheses warning. NFCI.

llvm-svn: 374326

5 years ago[Windows] Introduce a switch for the `lldb-server` mode on Windows
Aleksandr Urakov [Thu, 10 Oct 2019 12:21:04 +0000 (12:21 +0000)]
[Windows] Introduce a switch for the `lldb-server` mode on Windows

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

5 years agoRevert "Use -fdebug-compilation-dir to form absolute paths in coverage mappings"
Kadir Cetinkaya [Thu, 10 Oct 2019 12:20:11 +0000 (12:20 +0000)]
Revert "Use -fdebug-compilation-dir to form absolute paths in coverage mappings"

This reverts commit f6777964bde28c349d3e289ea37ecf5f5eeedbc4.

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

5 years agoTestFileHandle.py: relax exception type checks
Pavel Labath [Thu, 10 Oct 2019 12:07:30 +0000 (12:07 +0000)]
TestFileHandle.py: relax exception type checks

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

5 years agoFix sanitizer lint check after r374315
Russell Gallop [Thu, 10 Oct 2019 12:02:31 +0000 (12:02 +0000)]
Fix sanitizer lint check after r374315

llvm-svn: 374321

5 years ago[Mips] Fix 374055
Mirko Brkusanin [Thu, 10 Oct 2019 12:02:14 +0000 (12:02 +0000)]
[Mips] Fix 374055

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

5 years ago[test] Use system locale for mri-utf8.test
Thomas Preud'homme [Thu, 10 Oct 2019 11:48:30 +0000 (11:48 +0000)]
[test] Use system locale for mri-utf8.test

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

5 years ago[UBSan] Appease linter
Roman Lebedev [Thu, 10 Oct 2019 11:32:06 +0000 (11:32 +0000)]
[UBSan] Appease linter

llvm-svn: 374316

5 years ago[Sanitizers] Porting getrandom/getentropy interceptors to FreeBSD
David Carlier [Thu, 10 Oct 2019 11:31:37 +0000 (11:31 +0000)]
[Sanitizers] Porting getrandom/getentropy interceptors to FreeBSD

- 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

5 years ago[COFF] Wrap definitions in namespace lld { namespace coff {. NFC
Fangrui Song [Thu, 10 Oct 2019 11:27:58 +0000 (11:27 +0000)]
[COFF] Wrap definitions in namespace lld { namespace coff {. NFC

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

5 years ago[lldb][NFC] Remove strange bool parameter from Searcher::SearchCallback
Raphael Isemann [Thu, 10 Oct 2019 11:26:51 +0000 (11:26 +0000)]
[lldb][NFC] Remove strange bool parameter from Searcher::SearchCallback

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

5 years ago[lldb] Fix out of bounds read in DataExtractor::GetCStr and add unit test that function.
Raphael Isemann [Thu, 10 Oct 2019 11:15:38 +0000 (11:15 +0000)]
[lldb] Fix out of bounds read in DataExtractor::GetCStr and add unit test that function.

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

5 years ago[UBSan] Split nullptr-and-nonzero-offset-variable.c in another direction
Roman Lebedev [Thu, 10 Oct 2019 11:03:41 +0000 (11:03 +0000)]
[UBSan] Split nullptr-and-nonzero-offset-variable.c in another direction

llvm-svn: 374309

5 years agoRevert "[ASan] Do not misrepresent high value address dereferences as null dereferences"
Russell Gallop [Thu, 10 Oct 2019 10:56:52 +0000 (10:56 +0000)]
Revert "[ASan] Do not misrepresent high value address dereferences as null dereferences"

As it was breaking bots running sanitizer lint check

This reverts r374265 (git b577efe4567f1f6a711ad36e1d17280dd1c4f009)

llvm-svn: 374308

5 years ago[lldb][NFC] Use llvm::all_of instead of std::all_of in CppModuleConfiguration
Raphael Isemann [Thu, 10 Oct 2019 10:56:12 +0000 (10:56 +0000)]
[lldb][NFC] Use llvm::all_of instead of std::all_of in CppModuleConfiguration

llvm-svn: 374307

5 years ago[UBSan] Split nullptr-and-nonzero-offset-variable.cpp into C and C++ variants
Roman Lebedev [Thu, 10 Oct 2019 10:41:42 +0000 (10:41 +0000)]
[UBSan] Split nullptr-and-nonzero-offset-variable.cpp into C and C++ variants

I do not understand the BB failire, it fully passes locally.

llvm-svn: 374306

5 years ago[IfCvt][ARM] Optimise diamond if-conversion for code size
Oliver Stannard [Thu, 10 Oct 2019 09:58:28 +0000 (09:58 +0000)]
[IfCvt][ARM] Optimise diamond if-conversion for code size

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

5 years agos/@expectedFailure/@expectedFailureAll in TestFileHandle
Pavel Labath [Thu, 10 Oct 2019 09:52:32 +0000 (09:52 +0000)]
s/@expectedFailure/@expectedFailureAll in TestFileHandle

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

5 years ago[UBSan] Revisit nullptr-and-nonzero-offset-variable.cpp test to hopefully make it...
Roman Lebedev [Thu, 10 Oct 2019 09:51:13 +0000 (09:51 +0000)]
[UBSan] Revisit nullptr-and-nonzero-offset-variable.cpp test to hopefully make it pass on sanitizer-windows BB

llvm-svn: 374298

5 years agoUse error instead of fatal to report usage errors
Rui Ueyama [Thu, 10 Oct 2019 09:46:41 +0000 (09:46 +0000)]
Use error instead of fatal to report usage errors

Differential Revision: https://reviews.llvm.org/D68768

llvm-svn: 374297

5 years agoRemove rest of time-trace message as it is inconsistent style
Russell Gallop [Thu, 10 Oct 2019 09:33:53 +0000 (09:33 +0000)]
Remove rest of time-trace message as it is inconsistent style

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

5 years ago[UBSan][clang][compiler-rt] Applying non-zero offset to nullptr is undefined behaviour
Roman Lebedev [Thu, 10 Oct 2019 09:25:02 +0000 (09:25 +0000)]
[UBSan][clang][compiler-rt] Applying non-zero offset to nullptr is undefined behaviour

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

5 years ago[LLD] [MinGW] Look for other library patterns with -l
Martin Storsjo [Thu, 10 Oct 2019 08:52:39 +0000 (08:52 +0000)]
[LLD] [MinGW] Look for other library patterns with -l

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

5 years ago[LLD] [MinGW] Add a testcase for -l:name style library options. NFC.
Martin Storsjo [Thu, 10 Oct 2019 08:52:31 +0000 (08:52 +0000)]
[LLD] [MinGW] Add a testcase for -l:name style library options. NFC.

Differential Revision: https://reviews.llvm.org/D68688

llvm-svn: 374291

5 years agoImprove error message for bad SHF_MERGE sections
Rui Ueyama [Thu, 10 Oct 2019 08:32:12 +0000 (08:32 +0000)]
Improve error message for bad SHF_MERGE sections

This patch adds a section name to error messages.

Differential Revision: https://reviews.llvm.org/D68758

llvm-svn: 374290

5 years ago[lldb][NFC] Use unique_ptr in DiagnosticManager to express ownership
Raphael Isemann [Thu, 10 Oct 2019 08:30:10 +0000 (08:30 +0000)]
[lldb][NFC] Use unique_ptr in DiagnosticManager to express ownership

llvm-svn: 374289

5 years agoRecommit "[Clang] Pragma vectorize_width() implies vectorize(enable)"
Sjoerd Meijer [Thu, 10 Oct 2019 08:27:14 +0000 (08:27 +0000)]
Recommit "[Clang] Pragma vectorize_width() implies vectorize(enable)"

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

5 years ago[update_cc_test_checks] Support 'clang | opt | FileCheck'
Simon Tatham [Thu, 10 Oct 2019 08:25:34 +0000 (08:25 +0000)]
[update_cc_test_checks] Support 'clang | opt | FileCheck'

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

5 years ago[clang] prevent crash for nonnull attribut in constant context (Bug 43601)
Gauthier Harnisch [Thu, 10 Oct 2019 07:13:20 +0000 (07:13 +0000)]
[clang] prevent crash for nonnull attribut in constant context (Bug 43601)

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

5 years agoAMDGPU: Use SGPR_128 instead of SReg_128 for vregs
Matt Arsenault [Thu, 10 Oct 2019 07:11:33 +0000 (07:11 +0000)]
AMDGPU: Use SGPR_128 instead of SReg_128 for vregs

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

5 years ago[X86] Add test case for trunc_packus_v16i32_v16i8 with avx512vl+avx512bw and prefer...
Craig Topper [Thu, 10 Oct 2019 06:25:00 +0000 (06:25 +0000)]
[X86] Add test case for trunc_packus_v16i32_v16i8 with avx512vl+avx512bw and prefer-vector-width=256 and min-legal-vector-width=256. NFC

llvm-svn: 374283

5 years ago[Attributor][NFC] clang format
Johannes Doerfert [Thu, 10 Oct 2019 05:34:21 +0000 (05:34 +0000)]
[Attributor][NFC] clang format

llvm-svn: 374281

5 years ago[Attributor] Handle `null` differently in capture and alias logic
Johannes Doerfert [Thu, 10 Oct 2019 05:33:21 +0000 (05:33 +0000)]
[Attributor] Handle `null` differently in capture and alias logic

Summary:
`null` in the default address space (=AS 0) cannot be captured nor can
it alias anything. We make this clear now as it can be important for
callbacks and other cases later on. In addition, this patch improves the
debug output for noalias deduction.

Reviewers: sstefan1, uenoku

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68624

llvm-svn: 374280

5 years ago[WebAssembly] Wrap definitions in namespace lld { namespace wasm {. NFC
Fangrui Song [Thu, 10 Oct 2019 05:25:39 +0000 (05:25 +0000)]
[WebAssembly] Wrap definitions in namespace lld { namespace wasm {. NFC

Similar to D68323, but for wasm.

Reviewed By: ruiu

Differential Revision: https://reviews.llvm.org/D68759

llvm-svn: 374279

5 years agogn build: Merge r374277
GN Sync Bot [Thu, 10 Oct 2019 04:29:49 +0000 (04:29 +0000)]
gn build: Merge r374277

llvm-svn: 374278

5 years agoReland "[TextAPI] Introduce TBDv4"
Cyndy Ishida [Thu, 10 Oct 2019 04:24:44 +0000 (04:24 +0000)]
Reland "[TextAPI] Introduce TBDv4"

Original Patch broke for compilations w/ gcc and exposed asan fail.
This reland repairs those bugs.

Differential Revision: https://reviews.llvm.org/D67529

llvm-svn: 374277

5 years ago[ast] Fix indentation. NFC.
Michael Liao [Thu, 10 Oct 2019 04:16:52 +0000 (04:16 +0000)]
[ast] Fix indentation. NFC.

llvm-svn: 374276

5 years ago[lld][WebAssembly] Refactor markLive.cpp. NFC
Sam Clegg [Thu, 10 Oct 2019 03:23:06 +0000 (03:23 +0000)]
[lld][WebAssembly] Refactor markLive.cpp. NFC

This pattern matches the ELF implementation add if also useful as
part of a planned change where running `mark` more than once is needed.

Differential Revision: https://reviews.llvm.org/D68749

llvm-svn: 374275

5 years ago[sema] Revise `getCurrentMangleNumberContext` interface. NFC.
Michael Liao [Thu, 10 Oct 2019 03:14:51 +0000 (03:14 +0000)]
[sema] Revise `getCurrentMangleNumberContext` interface. NFC.

- Prefer returning mulitple values using a tuple instead of
  additional pointers/references.

llvm-svn: 374274

5 years ago[PowerPC] add testcase for ppc loop instr form prep - NFC
Chen Zheng [Thu, 10 Oct 2019 03:00:15 +0000 (03:00 +0000)]
[PowerPC] add testcase for ppc loop instr form prep - NFC

llvm-svn: 374273

5 years agogn build: (manually) merge r374271
Nico Weber [Thu, 10 Oct 2019 02:48:47 +0000 (02:48 +0000)]
gn build: (manually) merge r374271

llvm-svn: 374272

5 years ago[libTooling] Move Transformer files to their own directory/library.
Yitzhak Mandelbaum [Thu, 10 Oct 2019 02:34:47 +0000 (02:34 +0000)]
[libTooling] Move Transformer files to their own directory/library.

Summary:
The Transformer library has been growing inside of
lib/Tooling/Refactoring. However, it's not really related to anything else in
that directory. This revision moves all Transformer-related files into their own
include & lib directories.  A followup revision will (temporarily) add
forwarding headers to help any users migrate their code to the new location.

Reviewers: gribozavr

Subscribers: mgorny, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68637

llvm-svn: 374271

5 years agodummy comment typo fix commit to cycle the bots
Nico Weber [Thu, 10 Oct 2019 02:04:56 +0000 (02:04 +0000)]
dummy comment typo fix commit to cycle the bots

llvm-svn: 374270

5 years agoRe-land [mangle] Fix mangling where an extra mangle context is required.
Reid Kleckner [Thu, 10 Oct 2019 01:14:22 +0000 (01:14 +0000)]
Re-land [mangle] Fix mangling where an extra mangle context is required.

This reverts r374268 (git commit c34385d07c7d59447bf836b740f032235391d121)

I think I reverted this by mistake, so I'm relanding it. While my bisect
found this revision, I think the crashes I'm seeing locally must be
environmental. Maybe the version of clang I'm using miscompiles tot
clang.

llvm-svn: 374269

5 years agoRevert [mangle] Fix mangling where an extra mangle context is required.
Reid Kleckner [Thu, 10 Oct 2019 01:10:01 +0000 (01:10 +0000)]
Revert [mangle] Fix mangling where an extra mangle context is required.

This reverts r374200 (git commit fd18e94697c987d5f24e25aa4e27adaffff3cce4)

Causes crashes just compiling `int main() {}` on my machine.

llvm-svn: 374268

5 years ago[codeview] Try to avoid emitting .cv_loc with line zero
Reid Kleckner [Thu, 10 Oct 2019 01:06:01 +0000 (01:06 +0000)]
[codeview] Try to avoid emitting .cv_loc with line zero

Summary:
Visual Studio doesn't like it while stepping. It kicks you out of the
source view of the file being stepped through and tries to fall back to
the disassembly view.

Fixes PR43530

The fix is incomplete, because it's possible to have a basic block with
no source locations at all. In this case, we don't emit a .cv_loc, but
that will result in wrong stepping behavior in the debugger if the
layout predecessor of the location-less BB has an unrelated source
location. We could try harder to find a valid location that dominates or
post-dominates the current BB, but in general it's a dataflow problem,
and one still might not exist. I left a FIXME about this.

As an alternative, we might want to consider having the middle-end check
if its emitting codeview and get it to stop using line zero.

Reviewers: akhuang

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68747

llvm-svn: 374267

5 years agoUse -fdebug-compilation-dir to form absolute paths in coverage mappings
Reid Kleckner [Thu, 10 Oct 2019 00:54:33 +0000 (00:54 +0000)]
Use -fdebug-compilation-dir to form absolute paths in coverage mappings

This allows users to explicitly request relative paths with
`-fdebug-compilation-dir .`.

Fixes PR43614

Reviewers: vsk, arphaman

Differential Revision: https://reviews.llvm.org/D68733

llvm-svn: 374266

5 years ago[ASan] Do not misrepresent high value address dereferences as null dereferences
Julian Lettner [Thu, 10 Oct 2019 00:33:04 +0000 (00:33 +0000)]
[ASan] Do not misrepresent high value address dereferences as null dereferences

Dereferences with addresses above the 48-bit hardware addressable range
produce "invalid instruction" (instead of "invalid access") hardware
exceptions (there is no hardware address decoding logic for those bits),
and the address provided by this exception is the address of the
instruction (not the faulting address).  The kernel maps the "invalid
instruction" to SEGV, but fails to provide the real fault address.

Because of this ASan lies and says that those cases are null
dereferences.  This downgrades the severity of a found bug in terms of
security.  In the ASan signal handler, we can not provide the real
faulting address, but at least we can try not to lie.

rdar://50366151

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D68676

llvm-svn: 374265

5 years agoChange debugserver to use the brk #0 for breakpoints.
Jason Molenda [Thu, 10 Oct 2019 00:12:05 +0000 (00:12 +0000)]
Change debugserver to use the brk #0 for breakpoints.

debugserver had been using an instruction that would work
for armv7 or aarch64 processes, but we don't have armv7 code
running on arm64 devices any more so this is unnecessary.

<rdar://problem/56133118>

llvm-svn: 374264

5 years ago[CUDA][HIP] Fix host/device check with -fopenmp
Yaxun Liu [Wed, 9 Oct 2019 23:54:10 +0000 (23:54 +0000)]
[CUDA][HIP] Fix host/device check with -fopenmp

CUDA/HIP program may be compiled with -fopenmp. In this case, -fopenmp is only passed to host compilation
to take advantages of multi-threads computation.

CUDA/HIP and OpenMP both use Sema::DeviceCallGraph to store functions to be analyzed and remove them
once they decide the function is sure to be emitted. CUDA/HIP and OpenMP have different functions to determine
if a function is sure to be emitted.

To check host/device correctly for CUDA/HIP when -fopenmp is enabled, there needs a unified logic to determine
whether a function is to be emitted. The logic needs to be aware of both CUDA and OpenMP logic.

Differential Revision: https://reviews.llvm.org/D67837

llvm-svn: 374263

5 years agoTestMTCSimple.py: allow the test to run on Darwin embedded platforms
Frederic Riss [Wed, 9 Oct 2019 23:52:31 +0000 (23:52 +0000)]
TestMTCSimple.py: allow the test to run on Darwin embedded platforms

The test needed some updates to run using a different UI toolkit
and with a different libMTC, but it should run fine on a device.

llvm-svn: 374262

5 years agoConservatively add volatility and atomic checks in a few places
Philip Reames [Wed, 9 Oct 2019 23:43:33 +0000 (23:43 +0000)]
Conservatively add volatility and atomic checks in a few places

As background, starting in D66309, I'm working on support unordered atomics analogous to volatile flags on normal LoadSDNode/StoreSDNodes for X86.

As part of that, I spent some time going through usages of LoadSDNode and StoreSDNode looking for cases where we might have missed a volatility check or need an atomic check. I couldn't find any cases that clearly miscompile - i.e. no test cases - but a couple of pieces in code loop suspicious though I can't figure out how to exercise them.

This patch adds defensive checks and asserts in the places my manual audit found. If anyone has any ideas on how to either a) disprove any of the checks, or b) hit the bug they might be fixing, I welcome suggestions.

Differential Revision: https://reviews.llvm.org/D68419

llvm-svn: 374261

5 years agogn build: Merge r374245
GN Sync Bot [Wed, 9 Oct 2019 23:10:49 +0000 (23:10 +0000)]
gn build: Merge r374245

llvm-svn: 374260

5 years ago[WebAssembly] Fix tests missed in rL374235
Thomas Lively [Wed, 9 Oct 2019 23:06:38 +0000 (23:06 +0000)]
[WebAssembly] Fix tests missed in rL374235

llvm-svn: 374259

5 years ago[sanitizer_common] Remove OnPrint from Go build.
Matt Morehouse [Wed, 9 Oct 2019 22:57:07 +0000 (22:57 +0000)]
[sanitizer_common] Remove OnPrint from Go build.

Summary: Go now uses __sanitizer_on_print instead.

Reviewers: vitalybuka, dvyukov

Reviewed By: vitalybuka

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68621

llvm-svn: 374258

5 years agoAMDGPU: Don't fold copies to physregs
Matt Arsenault [Wed, 9 Oct 2019 22:51:42 +0000 (22:51 +0000)]
AMDGPU: Don't fold copies to physregs

In a future patch, this will help cleanup m0 handling.

The register coalescer handles copies from a register that
materializes an immediate, but doesn't handle move immediates
itself. The virtual register uses will often be allocated to the same
register, so there end up being no real copy.

llvm-svn: 374257

5 years agoTestIndirectSymbols: Modernize the Makefile
Frederic Riss [Wed, 9 Oct 2019 22:47:28 +0000 (22:47 +0000)]
TestIndirectSymbols: Modernize the Makefile

This old test used a completely hand-rolled Makefile. Modernize so that
it's able to cross-compile. And XFAIL the test as it fails on embedded
targets...

llvm-svn: 374256

5 years agoAMDGPU/GlobalISel: Fix crash on wide constant load with VGPR pointer
Matt Arsenault [Wed, 9 Oct 2019 22:44:49 +0000 (22:44 +0000)]
AMDGPU/GlobalISel: Fix crash on wide constant load with VGPR pointer

This was ignoring the register bank of the input pointer, and
isUniformMMO seems overly aggressive.

This will now conservatively assume a VGPR in cases where the incoming
bank hasn't been determined yet (i.e. is from a loop phi).

llvm-svn: 374255

5 years agoAMDGPU: Relax register classes used
Matt Arsenault [Wed, 9 Oct 2019 22:44:48 +0000 (22:44 +0000)]
AMDGPU: Relax register classes used

llvm-svn: 374254

5 years agoAMDGPU: Fix typos
Matt Arsenault [Wed, 9 Oct 2019 22:44:47 +0000 (22:44 +0000)]
AMDGPU: Fix typos

llvm-svn: 374253

5 years agoGlobalISel: Implement fewerElementsVector for G_BUILD_VECTOR
Matt Arsenault [Wed, 9 Oct 2019 22:44:43 +0000 (22:44 +0000)]
GlobalISel: Implement fewerElementsVector for G_BUILD_VECTOR

Turn it into a G_CONCAT_VECTORS of G_BUILD_VECTOR.

llvm-svn: 374252

5 years agoMakefile.rules: add missing CODESIGN call
Frederic Riss [Wed, 9 Oct 2019 22:35:56 +0000 (22:35 +0000)]
Makefile.rules: add missing CODESIGN call

When building an executable and a shared library at the same time (yes,
Makefile.rules is setup to do this!) the executable was not codesigned.

llvm-svn: 374251

5 years ago[lldb] Put site-packages into a sub dir of CMAKE_CFG_INTDIR
Haibo Huang [Wed, 9 Oct 2019 22:34:55 +0000 (22:34 +0000)]
[lldb] Put site-packages into a sub dir of CMAKE_CFG_INTDIR

Summary: Fixes issue like D68719

Reviewers: tatyana-krasnukha

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D68728

llvm-svn: 374250

5 years agogn build: (manually) merge r374219
Nico Weber [Wed, 9 Oct 2019 22:22:36 +0000 (22:22 +0000)]
gn build: (manually) merge r374219

llvm-svn: 374249

5 years ago[libc++][test] Miscellaneous MSVC cleanups
Casey Carter [Wed, 9 Oct 2019 22:19:17 +0000 (22:19 +0000)]
[libc++][test] Miscellaneous MSVC cleanups

* Silence unused-local-typedef warnings: `map.cons/assign_initializer_list.pass.cpp` (and the `set.cons` variant) uses a local typedef only within `LIBCPP_ASSERT`s, so clang diagnoses it as unused when testing non-libc++.
* Add missing include: `c.math/abs.pass.cpp` uses `std::numeric_limits` but failed to `#include <limits>`.
* Don't test non-type: A "recent" change to `meta.trans.other/underlying_type.pass.cpp` unconditionally tests the type `F` which is conditionally defined.
* Use `hash<long long>` instead of `hash<short>` with `int` in `unordered_meow` deduction guide tests to avoid truncation warnings.
* Convert `3.14` explicitly in `midpoint.float.pass` since MSVC incorrectly diagnoses `float meow = 3.14;` as truncating.

Differential Revision: https://reviews.llvm.org/D68681

llvm-svn: 374248

5 years agoSet eRegisterKindEHFrame register numbers for 32 bit ARM register contexts in minidumps
Greg Clayton [Wed, 9 Oct 2019 22:16:12 +0000 (22:16 +0000)]
Set eRegisterKindEHFrame register numbers for 32 bit ARM register contexts in minidumps

Stack unwinding was sometimes failing when trying to unwind stacks in 32 bit ARM. I discovered this was because the EH frame register numbers were not set. This patch fixes this issue and adds a unit test to verify this doesn't regress.

Differential Revision: https://reviews.llvm.org/D68088

llvm-svn: 374246

5 years ago[GISel] Refactor and split PatternMatchTest. NFC
Marcello Maggioni [Wed, 9 Oct 2019 22:10:10 +0000 (22:10 +0000)]
[GISel] Refactor and split PatternMatchTest. NFC

Split the ConstantFold part into a separate file and
make it use the fixture GISelMITest.

llvm-svn: 374245

5 years ago[CMake] Use the correct lit.cfg.py
Jonas Devlieghere [Wed, 9 Oct 2019 22:09:57 +0000 (22:09 +0000)]
[CMake] Use the correct lit.cfg.py

llvm-svn: 374244

5 years ago[InstCombine] Fix PR43617
Evandro Menezes [Wed, 9 Oct 2019 22:03:23 +0000 (22:03 +0000)]
[InstCombine] Fix PR43617

Check for `nullptr` before inspecting composite function.

llvm-svn: 374243

5 years agoFix a crasher due to an assert when two files have the same UUID but different paths.
Greg Clayton [Wed, 9 Oct 2019 22:03:15 +0000 (22:03 +0000)]
Fix a crasher due to an assert when two files have the same UUID but different paths.

Summary: The PlaceholderObjectFile has an assert in SetLoadAddress that fires if "m_base == value" is not true. To avoid this, we create check that the base address matches, and if it doesn't we clear the module that was found using the UUID so that we create a new PlaceholderObjectFile. Added a test to cover this issue.

Reviewers: labath, aadsm, dvlahovski

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D68106

llvm-svn: 374242

5 years ago[AMDGPU] Fixed dpp combine of VOP1
Stanislav Mekhanoshin [Wed, 9 Oct 2019 22:02:58 +0000 (22:02 +0000)]
[AMDGPU] Fixed dpp combine of VOP1

If original instruction did not have source modifiers they were
not added to the new DPP instruction as well, even if needed.

Differential Revision: https://reviews.llvm.org/D68729

llvm-svn: 374241

5 years ago[IRBuilder] Update IRBuilder::CreateFNeg(...) to return a UnaryOperator
Cameron McInally [Wed, 9 Oct 2019 21:52:15 +0000 (21:52 +0000)]
[IRBuilder] Update IRBuilder::CreateFNeg(...) to return a UnaryOperator

Also update Clang to call Builder.CreateFNeg(...) for UnaryMinus.

Differential Revision: https://reviews.llvm.org/D61675

llvm-svn: 374240

5 years agoremove a smattering of isolated, unnecessary uses of FILE*
Lawrence D'Anna [Wed, 9 Oct 2019 21:50:52 +0000 (21:50 +0000)]
remove a smattering of isolated, unnecessary uses of FILE*

Summary:
There a a few call sites that use FILE* which are easy to
fix without disrupting anything else.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: JDevlieghere, labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D68444

llvm-svn: 374239

5 years agoSBFile support in SBCommandReturnObject
Lawrence D'Anna [Wed, 9 Oct 2019 21:50:49 +0000 (21:50 +0000)]
SBFile support in SBCommandReturnObject

Summary:
This patch add SBFile interfaces to SBCommandReturnObject, and
removes the internal callers of its FILE* interfaces.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D68434

llvm-svn: 374238

5 years agoSBFile: add a bunch of tests that should eventually work.
Lawrence D'Anna [Wed, 9 Oct 2019 21:50:46 +0000 (21:50 +0000)]
SBFile: add a bunch of tests that should eventually work.

Summary:
It's really annoying and confusing to have to keep referring
back to earlier versions of this SBFile work to find the
tests that need to be added for each patch, and not duplicate
them with new tests.

This patch just imports all my tests.   A bunch of them don't
work yet, so they are marked to be skipped.   They'll be
unmarked as I fix them.

One of these tests will actually trip an assert in the SWIG
code now instead of just failing, so I'm fixing that here too.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: JDevlieghere, labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D68433

llvm-svn: 374237

5 years ago[Reproducer] Add convenience methods IsCapturing and IsReplaying.
Jonas Devlieghere [Wed, 9 Oct 2019 21:47:49 +0000 (21:47 +0000)]
[Reproducer] Add convenience methods IsCapturing and IsReplaying.

Add convenience methods to the Reproducer class for when you don't need
access to the generator and the loader.

llvm-svn: 374236

5 years ago[WebAssembly] Make returns variadic
Thomas Lively [Wed, 9 Oct 2019 21:42:08 +0000 (21:42 +0000)]
[WebAssembly] Make returns variadic

Summary:
This is necessary and sufficient to get simple cases of multiple
return working with multivalue enabled. More complex cases will
require block and loop signatures to be generalized to potentially be
type indices as well.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68684

llvm-svn: 374235

5 years agoTestHelloWorld: Make compatible with remote testing
Frederic Riss [Wed, 9 Oct 2019 21:41:02 +0000 (21:41 +0000)]
TestHelloWorld: Make compatible with remote testing

The synchronization token handling was not remote-friendly.

llvm-svn: 374234

5 years ago[SampleFDO] Add indexing for function profiles so they can be loaded on demand
Wei Mi [Wed, 9 Oct 2019 21:36:03 +0000 (21:36 +0000)]
[SampleFDO] Add indexing for function profiles so they can be loaded on demand
in ExtBinary format

Currently for Text, Binary and ExtBinary format profiles, when we compile a
module with samplefdo, even if there is no function showing up in the profile,
we have to load all the function profiles from the profile input. That is a
waste of compile time.

CompactBinary format profile has already had the support of loading function
profiles on demand. In this patch, we add the support to load profile on
demand for ExtBinary format. It will work no matter the sections in ExtBinary
format profile are compressed or not. Experiment shows it reduces the time to
compile a server benchmark by 30%.

When profile remapping and loading function profiles on demand are both used,
extra work needs to be done so that the loading on demand process will take
the name remapping into consideration. It will be addressed in a follow-up
patch.

Differential Revision: https://reviews.llvm.org/D68601

llvm-svn: 374233

5 years agollvm-dwarfdump: Support multiple debug_loclists contributions
David Blaikie [Wed, 9 Oct 2019 21:25:28 +0000 (21:25 +0000)]
llvm-dwarfdump: Support multiple debug_loclists contributions

Also fixing the incorrect "offset" field being computed/printed for each
location list.

llvm-svn: 374232

5 years ago[LLDB] Fix for regression of test 'TestDataFormatterInvalidStdUniquePtr.py' introduce...
Cameron Desrochers [Wed, 9 Oct 2019 21:15:48 +0000 (21:15 +0000)]
[LLDB] Fix for regression of test 'TestDataFormatterInvalidStdUniquePtr.py' introduced in r374195

Differential Revision: https://reviews.llvm.org/D68641

llvm-svn: 374231

5 years ago[Docs] Adds section for Additional Topics on Reference page
DeForest Richards [Wed, 9 Oct 2019 21:09:09 +0000 (21:09 +0000)]
[Docs] Adds section for Additional Topics on Reference page

Adds a new section for Additional Topics on the Reference documentation page. Also moves Support Library topic to User Guides page.

llvm-svn: 374230

5 years ago[LLDB] Remove standalone build dep on llvm-strip
Jonas Devlieghere [Wed, 9 Oct 2019 21:06:03 +0000 (21:06 +0000)]
[LLDB] Remove standalone build dep on llvm-strip

When building standalone, since llvm-strip is a symlink, it is created
using add_custom_command/add_custom_target which cannot be exported, and
thus cannot be depended on by lldb.

Patch by: Gwen Mittertreiner

Differential revision: https://reviews.llvm.org/D68614

llvm-svn: 374229

5 years ago[libFuzzer] Fix Alarm callback in fuchsia.
Jake Ehrlich [Wed, 9 Oct 2019 21:01:50 +0000 (21:01 +0000)]
[libFuzzer] Fix Alarm callback in fuchsia.

This patch adds an #if macro to skip the InFuzzingThread() comparison
for fuchsia, similar to what it is done for Windows and NetBSD.

In fuchsia, the alarm callback runs in a separate thread[0], making it fail
the comparison InFuzzingThread(), breaking the -timeout flag.

[0]:
https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp#L323

Author: charco (aka Marco  Vanotti)
Differential Revision: https://reviews.llvm.org/D68166

llvm-svn: 374228

5 years agoRevert "[lldb] Calculate relative path for symbol links"
Jim Ingham [Wed, 9 Oct 2019 20:56:43 +0000 (20:56 +0000)]
Revert "[lldb] Calculate relative path for symbol links"

This reverts commit 958091c209d0a92e38b9cb27fb77a0ff7da11853.

This commit incorrectly sets the _lldb.so symlink (at least it does when
building in Stefans' two build directory mode, where you build llvm with
cmake/ninja and lldb with cmake/Xcode, using a cmake generated project.

The _lldb.so link is SUPPOSED to point to:

bin/LLDB.framework/Versions/A/LLDB

but instead it points to

bin/LLDB

which is where LLDB was staged to before constructing the framework.  This
causes all sorts of problems when we then build the lldb driver into bin -
remember that MacOS is a case-preserving but case insensitive filesystem -
so when we later go to dlopen _lldb.so, we dlopen the main executable instead.

llvm-svn: 374226

5 years agoallow arbitrary python streams to be converted to SBFile
Lawrence D'Anna [Wed, 9 Oct 2019 20:56:17 +0000 (20:56 +0000)]
allow arbitrary python streams to be converted to SBFile

Summary:
This patch adds SWIG typemaps that can convert arbitrary python
file objects into lldb_private::File.

A SBFile may be initialized from a python file using the
constructor.   There are also alternate, tagged constructors
that allow python files to be borrowed, and for the caller
to control whether or not the python I/O methods will be
called even when a file descriptor is available.I

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: labath

Subscribers: zturner, amccarth, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D68188

llvm-svn: 374225