platform/upstream/llvm.git
5 years ago[testsuite] Recommit the TestTerminal directory.
Davide Italiano [Thu, 7 Mar 2019 21:33:43 +0000 (21:33 +0000)]
[testsuite] Recommit the TestTerminal directory.

Turns out this is actually testing that editline doesn't
screw up the terminal.

llvm-svn: 355640

5 years agoAdd secondary libstdc++ 4.8 and 5.1 detection mechanisms
Hubert Tong [Thu, 7 Mar 2019 21:28:33 +0000 (21:28 +0000)]
Add secondary libstdc++ 4.8 and 5.1 detection mechanisms

Summary:
The date-based approach to detecting unsupported versions of libstdc++
does not handle bug fix releases of older versions. As an example, the
`__GLIBCXX__` value associated with version 5.1, `20150422`, is less
than the values associated with versions 4.8.5 and 4.9.3.

This patch adds secondary checks based on certain properties in
sufficiently new versions of libstdc++.

Reviewers: jfb, tstellar, rnk, sfertile, nemanjai

Reviewed By: jfb

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 355638

5 years ago[lldb-vscode] Support running in server mode on Windows.
Zachary Turner [Thu, 7 Mar 2019 21:23:21 +0000 (21:23 +0000)]
[lldb-vscode] Support running in server mode on Windows.

Windows can't use standard i/o system calls such as read and write
to work with sockets, it instead needs to use the specific send
and recv calls.  This complicates matters for the debug adapter,
since it needs to be able to work in both server mode where it
communicates over a socket, as well as non-server mode where it
communicates via stdin and stdout.  To abstract this out, I've
introduced a class IOStream which hides all these details and
exposes a read/write interface that does the right on each
platform.

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

llvm-svn: 355637

5 years ago[X86] Correct scheduler information for rotate by constant for Haswell, Broadwell...
Craig Topper [Thu, 7 Mar 2019 21:22:56 +0000 (21:22 +0000)]
[X86] Correct scheduler information for rotate by constant for Haswell, Broadwell, and Skylake.

Rotate with explicit immediate is a single uop from Haswell on. An immediate of 1 has a dependency on the previous writer of flags, but the other immediate values do not.

The implicit rotate by 1 instruction is 2 uops. But the flags are merged after the rotate uop so the data result does not see the flag dependency. But I don't think we have any way of modeling that.

RORX is 1 uop without the load. 2 uops with the load. We currently model these with WriteShift/WriteShiftLd.

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

llvm-svn: 355636

5 years ago[X86] Model ADC/SBB with immediate 0 more accurately in the Haswell scheduler model
Craig Topper [Thu, 7 Mar 2019 21:22:51 +0000 (21:22 +0000)]
[X86] Model ADC/SBB with immediate 0 more accurately in the Haswell scheduler model

Haswell and possibly Sandybridge have an optimization for ADC/SBB with immediate 0 to use a single uop flow. This only applies GR16/GR32/GR64 with an 8-bit immediate. It does not apply to GR8. It also does not apply to the implicit AX/EAX/RAX forms.

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

llvm-svn: 355635

5 years ago[CodeGen] Reuse BlockUtils for -unreachableblockelim pass (NFC)
Brian Gesiak [Thu, 7 Mar 2019 20:40:55 +0000 (20:40 +0000)]
[CodeGen] Reuse BlockUtils for -unreachableblockelim pass (NFC)

Summary:
The logic in the -unreachableblockelim pass does the following:

1. It traverses the function it's given in depth-first order and
   creates a set of basic blocks that are unreachable from the
   function's entry node.
2. It iterates over each of those unreachable blocks and (1) removes any
   successors' references to the dead block, and (2) replaces any uses of
   instructions from the dead block with null.

The logic in (2) above is identical to what the `llvm::DeleteDeadBlocks`
function from `BasicBlockUtils.h` does. The only difference is that
`llvm::DeleteDeadBlocks` replaces uses of instructions from dead blocks
not with null, but with undef.

Replace the duplicate logic in the -unreachableblockelim pass with a
call to `llvm::DeleteDeadBlocks`. This results in less code but no
functional change (NFC).

Reviewers: mkazantsev, wmi, davidxl, silvas, davide

Reviewed By: davide

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 355634

5 years ago[TSan] Temporarily disable test which fails on build bot
Julian Lettner [Thu, 7 Mar 2019 20:30:18 +0000 (20:30 +0000)]
[TSan] Temporarily disable test which fails on build bot

llvm-svn: 355633

5 years agoAdd an LLVM-style dump method to CompilerType for extra convenience during debugging
Adrian Prantl [Thu, 7 Mar 2019 20:20:02 +0000 (20:20 +0000)]
Add an LLVM-style dump method to CompilerType for extra convenience during debugging

This change has no effect on Release (NoAsserts) builds.

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

llvm-svn: 355632

5 years ago[ExpressionParser] Implement ComputeClangResourceDir for Windows
Alex Langford [Thu, 7 Mar 2019 20:09:15 +0000 (20:09 +0000)]
[ExpressionParser] Implement ComputeClangResourceDir for Windows

Summary: This function is useful for expression evaluation, especially when doing swift debugging on windows.

Reviewers: aprantl, labath

Reviewed By: labath

Subscribers: teemperor, jdoerfert, lldb-commits

Tags: #lldb

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

llvm-svn: 355631

5 years agoAMDHSA: Code object v3 updates
Konstantin Zhuravlyov [Thu, 7 Mar 2019 19:58:29 +0000 (19:58 +0000)]
AMDHSA: Code object v3 updates

  - Copy kernel symbol attributes into kernel descriptor attributes
  - Make sure kernel symbol's visibility is not "higher" than protected

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

llvm-svn: 355630

5 years ago[lldb] Fix DW_OP_addrx uses.
Ali Tamur [Thu, 7 Mar 2019 19:41:08 +0000 (19:41 +0000)]
[lldb] Fix DW_OP_addrx uses.

Summary: DW_OP_GNU_addr_index has been renamed as DW_OP_addrx in the standard. clang produces DW_OP_addrx tags and with this change lldb starts to process them.

Reviewers: aprantl, jingham, davide, clayborg, serge-sans-paille

Reviewed By: aprantl

Subscribers: jdoerfert, dblaikie, labath, shafik, lldb-commits

Tags: #lldb

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

llvm-svn: 355629

5 years ago[llvm-mca] Emit a message when no bottlenecks are identified.
Matt Davis [Thu, 7 Mar 2019 19:34:44 +0000 (19:34 +0000)]
[llvm-mca] Emit a message when no bottlenecks are identified.

Summary:
Since bottleneck hints are enabled via user request, it can be
confusing if no bottleneck information is presented.  Such is the
case when no bottlenecks are identified.  This patch emits a message
in that case.

Reviewers: andreadb

Reviewed By: andreadb

Subscribers: tschuett, gbedwell, llvm-commits

Tags: #llvm

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

llvm-svn: 355628

5 years agoRecommit "Support attribute used in member funcs of class templates"
Rafael Auler [Thu, 7 Mar 2019 19:14:30 +0000 (19:14 +0000)]
Recommit "Support attribute used in member funcs of class templates"

The patch originally broke code that was incompatible with GCC, but
we want to follow GCC behavior here according to the discussion in
https://reviews.llvm.org/D58216

Original commit message:
As PR17480 describes, clang does not support the used attribute
for member functions of class templates. This means that if the member
function is not used, its definition is never instantiated. This patch
changes clang to emit the definition if it has the used attribute.

Test Plan: Added a testcase

Reviewed By: aaron.ballman

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

llvm-svn: 355627

5 years ago[GN] Remove DataLayoutTest.cpp from IR Unittests.
Mitch Phillips [Thu, 7 Mar 2019 18:58:45 +0000 (18:58 +0000)]
[GN] Remove DataLayoutTest.cpp from IR Unittests.

Merge of GN files to fit with rL355616.

llvm-svn: 355626

5 years agoFix some clang analysis tests passing arguments incorrectly
Reid Kleckner [Thu, 7 Mar 2019 18:57:04 +0000 (18:57 +0000)]
Fix some clang analysis tests passing arguments incorrectly

llvm-svn: 355625

5 years agoDelete x86_64 ShadowCallStack support
Vlad Tsyrklevich [Thu, 7 Mar 2019 18:56:36 +0000 (18:56 +0000)]
Delete x86_64 ShadowCallStack support

Summary:
ShadowCallStack on x86_64 suffered from the same racy security issues as
Return Flow Guard and had performance overhead as high as 13% depending
on the benchmark. x86_64 ShadowCallStack was always an experimental
feature and never shipped a runtime required to support it, as such
there are no expected downstream users.

Reviewers: pcc

Reviewed By: pcc

Subscribers: mgorny, javed.absar, hiraditya, jdoerfert, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

llvm-svn: 355624

5 years ago[PowerPC] Run clang format to avoid compiling warning.
Jinsong Ji [Thu, 7 Mar 2019 18:55:21 +0000 (18:55 +0000)]
[PowerPC] Run clang format to avoid compiling warning.

llvm-svn: 355623

5 years agoELF: Reduce the size of InputSectionBase by two words. NFCI.
Peter Collingbourne [Thu, 7 Mar 2019 18:48:12 +0000 (18:48 +0000)]
ELF: Reduce the size of InputSectionBase by two words. NFCI.

- The Assigned bit was previously taking a word on its own. Move
  it into the bit fields in SectionBase.
- NumRelocations and AreRelocsRela were previously also taking up
  a word despite only using half of it. Move them into the alignment gap
  after SectionBase's fields.

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

llvm-svn: 355622

5 years agofix expected format in test/ELF/eh-frame-hdr-augmentation.s
Petar Jovanovic [Thu, 7 Mar 2019 18:28:44 +0000 (18:28 +0000)]
fix expected format in test/ELF/eh-frame-hdr-augmentation.s

Follow-up for r355605.
Fix expected format in test/ELF/eh-frame-hdr-augmentation.s

llvm-svn: 355621

5 years ago[NFC][TSan] Remove unnecessary #include
Julian Lettner [Thu, 7 Mar 2019 18:22:22 +0000 (18:22 +0000)]
[NFC][TSan] Remove unnecessary #include

llvm-svn: 355620

5 years ago[TSan][Linux] Fix libdispatch interception macros compilation errors
Julian Lettner [Thu, 7 Mar 2019 18:15:29 +0000 (18:15 +0000)]
[TSan][Linux] Fix libdispatch interception macros compilation errors

Most libdispatch functions come in two variants: callbacks can be
specified via blocks or function pointers. Some of our interceptors for
the block variant actually forward to the function variant. However, on
Linux, `DECLARE_REAL(name)` has to appear before `REAL(name)`.

This patch reorders _f variant interceptors before _b variants
where possible and forward declares the _f variant in the remaining
cases (cyclic dependency between _f and _b interceptors).

Also rename macro to DISPATCH_INTERCEPT_ASYNC_F for better consistency.

Reviewed By: dvyukov

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

llvm-svn: 355619

5 years ago[NFC][TSan] Add libdispatch tests for non-Darwin platforms
Julian Lettner [Thu, 7 Mar 2019 18:15:26 +0000 (18:15 +0000)]
[NFC][TSan] Add libdispatch tests for non-Darwin platforms

Add new sets of tests (copy instead of move existing tests) because
there could be subtle differences between C/Obj-C and with/without
Foundation etc.

Reviewed By: dvyukov

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

llvm-svn: 355618

5 years ago[Sanitizer] Add 'dispatch' feature to be used in compiler-rt tests
Julian Lettner [Thu, 7 Mar 2019 18:15:23 +0000 (18:15 +0000)]
[Sanitizer] Add 'dispatch' feature to be used in compiler-rt tests

Reviewed By: dvyukov

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

llvm-svn: 355617

5 years agoRollback of rL355585.
Mitch Phillips [Thu, 7 Mar 2019 18:13:39 +0000 (18:13 +0000)]
Rollback of rL355585.

Introduces memory leak in FunctionTest.GetPointerAlignment that breaks sanitizer buildbots:

```
=================================================================
==2453==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0x610428 in operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:105
    #1 0x16936bc in llvm::User::operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/User.cpp:151:19
    #2 0x7c3fe9 in Create /b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/IR/Function.h:144:12
    #3 0x7c3fe9 in (anonymous namespace)::FunctionTest_GetPointerAlignment_Test::TestBody() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/unittests/IR/FunctionTest.cpp:136
    #4 0x1a836a0 in HandleExceptionsInMethodIfSupported<testing::Test, void> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #5 0x1a836a0 in testing::Test::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2474
    #6 0x1a85c55 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
    #7 0x1a870d0 in testing::TestCase::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
    #8 0x1aa5b84 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
    #9 0x1aa4d30 in HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #10 0x1aa4d30 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4257
    #11 0x1a6b656 in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
    #12 0x1a6b656 in main /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50
    #13 0x7f5af37a22e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)

Indirect leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x610428 in operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:105
    #1 0x151be6b in make_unique<llvm::ValueSymbolTable> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/ADT/STLExtras.h:1349:29
    #2 0x151be6b in llvm::Function::Function(llvm::FunctionType*, llvm::GlobalValue::LinkageTypes, unsigned int, llvm::Twine const&, llvm::Module*) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/Function.cpp:241
    #3 0x7c4006 in Create /b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/IR/Function.h:144:16
    #4 0x7c4006 in (anonymous namespace)::FunctionTest_GetPointerAlignment_Test::TestBody() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/unittests/IR/FunctionTest.cpp:136
    #5 0x1a836a0 in HandleExceptionsInMethodIfSupported<testing::Test, void> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #6 0x1a836a0 in testing::Test::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2474
    #7 0x1a85c55 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
    #8 0x1a870d0 in testing::TestCase::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
    #9 0x1aa5b84 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
    #10 0x1aa4d30 in HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #11 0x1aa4d30 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4257
    #12 0x1a6b656 in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
    #13 0x1a6b656 in main /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50
    #14 0x7f5af37a22e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)

SUMMARY: AddressSanitizer: 168 byte(s) leaked in 2 allocation(s).
```

See http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/11358/steps/check-llvm%20asan/logs/stdio for more information.

Also introduces use-of-uninitialized-value in ConstantsTest.FoldGlobalVariablePtr:
```
==7070==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x14e703c in User /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/User.h:79:5
    #1 0x14e703c in Constant /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/Constant.h:44
    #2 0x14e703c in llvm::GlobalValue::GlobalValue(llvm::Type*, llvm::Value::ValueTy, llvm::Use*, unsigned int, llvm::GlobalValue::LinkageTypes, llvm::Twine const&, unsigned int) /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/GlobalValue.h:78
    #3 0x14e5467 in GlobalObject /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/GlobalObject.h:34:9
    #4 0x14e5467 in llvm::GlobalVariable::GlobalVariable(llvm::Type*, bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&, llvm::GlobalValue::ThreadLocalMode, unsigned int, bool) /b/sanitizer-x86_64-linux-fast/build/llvm/lib/IR/Globals.cpp:314
    #5 0x6938f1 in llvm::(anonymous namespace)::ConstantsTest_FoldGlobalVariablePtr_Test::TestBody() /b/sanitizer-x86_64-linux-fast/build/llvm/unittests/IR/ConstantsTest.cpp:565:18
    #6 0x1a240a1 in HandleExceptionsInMethodIfSupported<testing::Test, void> /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc
    #7 0x1a240a1 in testing::Test::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2474
    #8 0x1a26d26 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
    #9 0x1a2815f in testing::TestCase::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
    #10 0x1a43de8 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
    #11 0x1a42c47 in HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc
    #12 0x1a42c47 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:4257
    #13 0x1a0dfba in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
    #14 0x1a0dfba in main /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50
    #15 0x7f2081c412e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #16 0x4dff49 in _start (/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/unittests/IR/IRTests+0x4dff49)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/User.h:79:5 in User
```

See http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/30222/steps/check-llvm%20msan/logs/stdio for more information.

llvm-svn: 355616

5 years ago[testsuite] Spring cleaning: this tests `stty`, not `lldb`.
Davide Italiano [Thu, 7 Mar 2019 18:05:18 +0000 (18:05 +0000)]
[testsuite] Spring cleaning: this tests `stty`, not `lldb`.

llvm-svn: 355615

5 years ago[OPENMP 5.0]Add initial support for 'allocate' directive.
Alexey Bataev [Thu, 7 Mar 2019 17:54:44 +0000 (17:54 +0000)]
[OPENMP 5.0]Add initial support for 'allocate' directive.

Added parsing/sema analysis/serialization/deserialization support for
'allocate' directive.

llvm-svn: 355614

5 years ago[InterleavedAccessAnalysis] Fix integer overflow in insertMember.
Florian Hahn [Thu, 7 Mar 2019 17:50:16 +0000 (17:50 +0000)]
[InterleavedAccessAnalysis] Fix integer overflow in insertMember.

Without checking for integer overflow, invalid members can be added
 e.g. if the calculated key overflows, becomes positive and the largest key.

This fixes
      https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7560
      https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13128
      https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13229

Reviewers: Ayal, anna, hsaito, efriedma

Reviewed By: efriedma

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

llvm-svn: 355613

5 years ago[testsuite] Drop characters that can't be decoded, restoring parity with Py2.
Davide Italiano [Thu, 7 Mar 2019 17:45:53 +0000 (17:45 +0000)]
[testsuite] Drop characters that can't be decoded, restoring parity with Py2.

Tests that check the output of `memory find` may trip over
unreadable characters, and in Python 3 this is an error.

llvm-svn: 355612

5 years agoFix TestDataFormatter.test uninitialized variable
Jan Kratochvil [Thu, 7 Mar 2019 17:35:47 +0000 (17:35 +0000)]
Fix TestDataFormatter.test uninitialized variable

After D55626 I see a failure in my Fedora buildbot.

There is uninitialized variable as the Foo constructor has not been run and foo
is an autovariable.

(lldb) breakpoint set -f foo.cpp -l 11
Breakpoint 1: where = TestDataFormatter.test.tmp.out`main + 30 at foo.cpp:11:7, address = 0x000000000040112e
(lldb) run
Process 801065 stopped
* thread #1, name = 'TestDataFormatt', stop reason = breakpoint 1.1
    frame #0: 0x000000000040112e TestDataFormatter.test.tmp.out`main(argc=1, argv=0x00007fffffffcc48) at foo.cpp:11:7
   8    };
   9
   10   int main(int argc, char **argv) {
-> 11     Foo foo(1, 2.22);
   12     return 0;
   13   }

Process 801065 launched: '.../tools/lldb/lit/Reproducer/Functionalities/Output/TestDataFormatter.test.tmp.out' (x86_64)
(lldb) frame var
(int) argc = 1
(char **) argv = 0x00007fffffffcc48
(Foo) foo = (m_i = 4198432, m_d = 0)

While the testcase expects m_i will be 0.

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

llvm-svn: 355611

5 years ago[Reproducers] Disable registering lldb::thread_t everywhere
Jonas Devlieghere [Thu, 7 Mar 2019 17:27:33 +0000 (17:27 +0000)]
[Reproducers] Disable registering lldb::thread_t everywhere

As discussed on the mailing list, default serialization for thread ids
is not correct, even if they're represented as basic types. I'm
purposely leaving the corresponding record macros in place so that we
don't break the API boundary detection.

llvm-svn: 355610

5 years ago[Sema] Change addr space diagnostics in casts to follow C++ style.
Anastasia Stulova [Thu, 7 Mar 2019 17:06:30 +0000 (17:06 +0000)]
[Sema] Change addr space diagnostics in casts to follow C++ style.

This change adds a new diagnostic for mismatching address spaces
to be used for C++ casts (only enabled in C style cast for now,
the rest will follow!).

The change extends C-style cast rules to account for address spaces.
It also adds a separate function for address space cast checking that
can be used to map from a separate address space cast operator
addrspace_cast (to be added as a follow up patch).

Note, that after this change clang will no longer allows arbitrary
address space conversions in reinterpret_casts because they can lead
to accidental errors. The implicit safe conversions would still be
allowed.

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

llvm-svn: 355609

5 years ago[PR40778][Sema] Adjust addr space of operands in builtin operators.
Anastasia Stulova [Thu, 7 Mar 2019 16:43:41 +0000 (16:43 +0000)]
[PR40778][Sema] Adjust addr space of operands in builtin operators.

Adjust address space for references and pointer operands of builtin operators.

Currently this change only fixes addr space in assignment (= and |=) operator,
that is needed for the test case reported in the bug. Wider support for all
other operations will follow.

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

llvm-svn: 355608

5 years ago[DebugInfo] Fix the type of the formated variable
Petar Jovanovic [Thu, 7 Mar 2019 16:31:08 +0000 (16:31 +0000)]
[DebugInfo] Fix the type of the formated variable

Change the format type of *Personality and *LSDAAddress to PRIx64 since
they are of type uint64_t.
The problem was detected on mips builds, where it was printing junk values
and causing test failure.

Patch by Milos Stojanovic.

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

llvm-svn: 355607

5 years ago[PR40778] Preserve addr space in Derived to Base cast.
Anastasia Stulova [Thu, 7 Mar 2019 16:23:15 +0000 (16:23 +0000)]
[PR40778] Preserve addr space in Derived to Base cast.

The address space for the Base class pointer when up-casting
from Derived should be taken from the Derived class pointer.

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

llvm-svn: 355606

5 years ago[analyzer] handle modification of vars inside an expr with comma operator
Petar Jovanovic [Thu, 7 Mar 2019 15:50:52 +0000 (15:50 +0000)]
[analyzer] handle modification of vars inside an expr with comma operator

We should track mutation of a variable within a comma operator expression.
Current code in ExprMutationAnalyzer does not handle it.

This will handle cases like:

(a, b) ++ < == b is modified
(a, b) = c < == b is modifed

Patch by Djordje Todorovic.

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

llvm-svn: 355605

5 years agogn build: Port r342002
Nico Weber [Thu, 7 Mar 2019 15:44:59 +0000 (15:44 +0000)]
gn build: Port r342002

I had hoped we could remove the dependency on shell32.lib from lib/Support
(there isn't much depending on it), but looks like this will take a while. So
for now, port this over.

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

llvm-svn: 355604

5 years agogn build: Merge r355522
Nico Weber [Thu, 7 Mar 2019 15:43:14 +0000 (15:43 +0000)]
gn build: Merge r355522

llvm-svn: 355603

5 years ago[LLD][COFF] Restrict the failifmismatch test to x86_64-windows-msvc because the ELF...
Alexandre Ganea [Thu, 7 Mar 2019 15:07:55 +0000 (15:07 +0000)]
[LLD][COFF] Restrict the failifmismatch test to x86_64-windows-msvc because the ELF container doesn't support llvm.linker.options meta-data with only one operand.

llvm-svn: 355602

5 years agoexpected-no-diagnostics@ does not make sense, switching to a more idiomatic form...
Aaron Ballman [Thu, 7 Mar 2019 15:03:06 +0000 (15:03 +0000)]
expected-no-diagnostics@ does not make sense, switching to a more idiomatic form; NFC.

llvm-svn: 355601

5 years ago[llvm-readobj] Dump DT_USED value as string like GNU readelf does
Xing GUO [Thu, 7 Mar 2019 14:53:10 +0000 (14:53 +0000)]
[llvm-readobj] Dump DT_USED value as string like GNU readelf does

Reviewers: jhenderson

Reviewed By: jhenderson

Subscribers: rupprecht, llvm-commits

Tags: #llvm

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

llvm-svn: 355600

5 years ago[clangd] Strip plugin arguments in clangd-indexer.
Haojian Wu [Thu, 7 Mar 2019 14:47:17 +0000 (14:47 +0000)]
[clangd] Strip plugin arguments in clangd-indexer.

Summary: This would allow clangd-indexer runs on chromium repo.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 355599

5 years ago[ASTImporter] Changed use of Import to Import_New in ASTImporter.
Balazs Keri [Thu, 7 Mar 2019 14:09:18 +0000 (14:09 +0000)]
[ASTImporter] Changed use of Import to Import_New in ASTImporter.

Reviewers: a.sidorin, shafik, a_sidorin, martong

Reviewed By: a_sidorin

Subscribers: rnkovacs, jdoerfert, davide, aprantl, llvm-commits, gamesh411, a_sidorin, dkrupp, martong, Szelethus, cfe-commits

Tags: #clang

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

llvm-svn: 355598

5 years ago[LSR] Attempt to increase the accuracy of LSR's setup cost
David Green [Thu, 7 Mar 2019 13:44:40 +0000 (13:44 +0000)]
[LSR] Attempt to increase the accuracy of LSR's setup cost

In some loops, we end up generating loop induction variables that look like:
  {(-1 * (zext i16 (%i0 * %i1) to i32))<nsw>,+,1}
As opposed to the simpler:
  {(zext i16 (%i0 * %i1) to i32),+,-1}
i.e we count up from -limit to 0, not the simpler counting down from limit to
0. This is because the scores, as LSR calculates them, are the same and the
second is filtered in place of the first. We end up with a redundant SUB from 0
in the code.

This patch tries to make the calculation of the setup cost a little more
thoroughly, recursing into the scev members to better approximate the setup
required. The cost function for comparing LSR costs is:

return std::tie(C1.NumRegs, C1.AddRecCost, C1.NumIVMuls, C1.NumBaseAdds,
                C1.ScaleCost, C1.ImmCost, C1.SetupCost) <
       std::tie(C2.NumRegs, C2.AddRecCost, C2.NumIVMuls, C2.NumBaseAdds,
                C2.ScaleCost, C2.ImmCost, C2.SetupCost);
So this will only alter results if none of the other variables turn out to be
different.

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

llvm-svn: 355597

5 years ago[ASTImporter] Import member expr with explicit template args
Gabor Marton [Thu, 7 Mar 2019 13:38:20 +0000 (13:38 +0000)]
[ASTImporter] Import member expr with explicit template args

Summary:
Member expressions with explicit template arguments were not imported
correctly: the DeclRefExpr was missing. This patch fixes.

Reviewers: a_sidorin, shafik, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

llvm-svn: 355596

5 years ago[LLD][COFF] Attempt fix for failifmismatch test on aarch64-only builder.
Alexandre Ganea [Thu, 7 Mar 2019 13:32:29 +0000 (13:32 +0000)]
[LLD][COFF] Attempt fix for failifmismatch test on aarch64-only builder.

Shall fix: http://lab.llvm.org:8011/builders/clang-cmake-aarch64-lld/builds/6150

llvm-svn: 355595

5 years ago[MIPS GlobalISel] Fix mul operands
Petar Avramovic [Thu, 7 Mar 2019 13:28:29 +0000 (13:28 +0000)]
[MIPS GlobalISel] Fix mul operands

Unsigned mul high for MIPS32 is selected into two PseudoInstructions:
PseudoMULTu and PseudoMFHI that use accumulator register class ACC64 for
some of its operands. Registers in this class have appropriate hi and lo
register as subregisters: $lo0 and $hi0 are subregisters of $ac0 etc.
mul instruction implicit-defs $lo0 and $hi0 according to MipsInstrInfo.td.
In functions where mul and PseudoMULTu are present fastRegisterAllocator
will "run out of registers during register allocation" because
'calcSpillCost' for $ac0 will return spillImpossible because subregisters
$lo0 and $hi0 of $ac0 are reserved by mul instruction above. A solution is
to mark implicit-defs of $lo0 and $hi0 as dead in mul instruction.

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

llvm-svn: 355594

5 years ago[ASTImporter] Handle redecl chain of FunctionTemplateDecls
Gabor Marton [Thu, 7 Mar 2019 13:01:51 +0000 (13:01 +0000)]
[ASTImporter] Handle redecl chain of FunctionTemplateDecls

Summary:
Redecl chains of function templates are not handled well currently. We
want to handle them similarly to functions, i.e. try to keep the
structure of the original AST as much as possible. The aim is to not
squash a prototype with a definition, rather we create both and put them
in a redecl chain.

Reviewers: a_sidorin, shafik, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

llvm-svn: 355593

5 years ago[analyzer] Handle comparison between non-default AS symbol and constant
David Stenberg [Thu, 7 Mar 2019 13:01:17 +0000 (13:01 +0000)]
[analyzer] Handle comparison between non-default AS symbol and constant

Summary:
When comparing a symbolic region and a constant, the constant would be
widened or truncated to the width of a void pointer, meaning that the
constant could be incorrectly truncated when handling symbols for
non-default address spaces. In the attached test case this resulted in a
false positive since the constant was truncated to zero. To fix this,
widen/truncate the constant to the width of the symbol expression's
type.

This commit does not consider non-symbolic regions as I'm not sure how
to generalize getting the type there.

This fixes PR40814.

Reviewers: NoQ, zaks.anna, george.karpenkov

Reviewed By: NoQ

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, jdoerfert, Charusso, cfe-commits

Tags: #clang

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

llvm-svn: 355592

5 years ago[yaml2obj] - Allow producing ELFDATANONE ELFs
George Rimar [Thu, 7 Mar 2019 12:09:19 +0000 (12:09 +0000)]
[yaml2obj] - Allow producing ELFDATANONE ELFs

I need this to remove a binary from LLD test suite.
The patch also simplifies the code a bit.

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

llvm-svn: 355591

5 years agoFix & re-enable test that intermittently failed in debug mode.
Michael Platings [Thu, 7 Mar 2019 11:55:26 +0000 (11:55 +0000)]
Fix & re-enable test that intermittently failed in debug mode.

The Value class and derivates will have uninitialized member variables if not created via operator new.

llvm-svn: 355590

5 years ago[IDF] Delete a redundant J-edge test
Fangrui Song [Thu, 7 Mar 2019 11:42:59 +0000 (11:42 +0000)]
[IDF] Delete a redundant J-edge test

In the DJ-graph based computation of iterated dominance frontiers,
SuccNode->getIDom() == Node is one of the tests to check if (Node,Succ)
is a J-edge. If it is true, since Node is dominated by Root,

  SuccLevel = level(Node)+1 > RootLevel

which means the next test SuccLevel > RootLevel will also be true. test
the check is redundant and can be deleted as it also involves one
indirection and provides no speed-up.

llvm-svn: 355589

5 years agoTemporarily disable newly added test that fails in debug mode.
Michael Platings [Thu, 7 Mar 2019 10:27:10 +0000 (10:27 +0000)]
Temporarily disable newly added test that fails in debug mode.

llvm-svn: 355588

5 years agoAdd newline to interpreter debugging output
Kristof Beyls [Thu, 7 Mar 2019 10:14:38 +0000 (10:14 +0000)]
Add newline to interpreter debugging output

When running lli --debug --force-interpreter=true the executed instructions are
printed but are missing newlines. This commit adds the missing newlines.

Patch by Andrew Brown.

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

llvm-svn: 355587

5 years ago[libclang] Fix CXTranslationUnit_KeepGoing
Ivan Donchevskii [Thu, 7 Mar 2019 10:13:50 +0000 (10:13 +0000)]
[libclang] Fix CXTranslationUnit_KeepGoing

Since
  commit 56f548bbbb7e4387a69708f70724d00e9e076153
  [modules] Round-trip -Werror flag through explicit module build.
the behavior of CXTranslationUnit_KeepGoing changed:
Unresolved #includes are fatal errors again. As a consequence, some
templates are not instantiated and lead to confusing errors.

Revert to the old behavior: With CXTranslationUnit_KeepGoing fatal
errors are mapped to errors.

Patch by Nikolai Kosjar.

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

llvm-svn: 355586

5 years ago[IR][ARM] Add function pointer alignment to datalayout
Michael Platings [Thu, 7 Mar 2019 09:15:23 +0000 (09:15 +0000)]
[IR][ARM] Add function pointer alignment to datalayout

Use this feature to fix a bug on ARM where 4 byte alignment is
incorrectly assumed.

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

llvm-svn: 355585

5 years ago[BDCE] Optimize find+insert with early insert
Fangrui Song [Thu, 7 Mar 2019 06:38:03 +0000 (06:38 +0000)]
[BDCE] Optimize find+insert with early insert

llvm-svn: 355583

5 years ago[X86] Enable combineFMinNumFMaxNum for 512 bit vectors when AVX512 is enabled.
Craig Topper [Thu, 7 Mar 2019 06:30:19 +0000 (06:30 +0000)]
[X86] Enable combineFMinNumFMaxNum for 512 bit vectors when AVX512 is enabled.

Simplified by just checking if the vector type is legal rather than listing all combinations of types and features.

Fixes PR40984.

llvm-svn: 355582

5 years ago[X86] Add 512-bit fminnum/maxnum test cases for PR40984. Also add v8f32 minnum/maxnum...
Craig Topper [Thu, 7 Mar 2019 05:56:52 +0000 (05:56 +0000)]
[X86] Add 512-bit fminnum/maxnum test cases for PR40984. Also add v8f32 minnum/maxnum tests. NFC

llvm-svn: 355581

5 years ago[WebAssembly] Fix build after rL355577
Sam Clegg [Thu, 7 Mar 2019 04:20:04 +0000 (04:20 +0000)]
[WebAssembly] Fix build after rL355577

Turns own that IsUsedInRegularObject is set for lazy (archive) symbols.

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

llvm-svn: 355580

5 years agoSkip TestGdbserverPort.test on Windows
Jan Kratochvil [Thu, 7 Mar 2019 03:41:00 +0000 (03:41 +0000)]
Skip TestGdbserverPort.test on Windows

lldb/cmake/modules/LLDBConfig.cmake does not build lldb-server on Windows:
if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
    set(LLDB_CAN_USE_LLDB_SERVER 1)

Also do not append 'platform' parameter twice - although that was quietly
ignored.

llvm-svn: 355579

5 years agoWhen disassembling Aarch64 target and vendor Apple, set the cpu to
Jason Molenda [Thu, 7 Mar 2019 03:16:45 +0000 (03:16 +0000)]
When disassembling Aarch64 target and vendor Apple, set the cpu to
"apple-latest" which llvm uses to indicate the newest supported ISA.
Add a unit test; I'm only testing an armv8.1 instruction in this
unit test which would already be disassembled correctly because we
set the disassembler to ARM v8.2 mode, but it ensures that nothing
has been broken by adding this cpu spec.

<rdar://problem/38714781>

llvm-svn: 355578

5 years ago[WebAssembly] LTO: Don't include bitcode-only symbols in the symtab
Sam Clegg [Thu, 7 Mar 2019 02:43:19 +0000 (02:43 +0000)]
[WebAssembly] LTO: Don't include bitcode-only symbols in the symtab

Fixes https://bugs.llvm.org/show_bug.cgi?id=40654

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

llvm-svn: 355577

5 years ago[InterleavedAccessAnalysis] Use fixed size integers for InterleaveGroup.
Florian Hahn [Thu, 7 Mar 2019 02:19:11 +0000 (02:19 +0000)]
[InterleavedAccessAnalysis] Use fixed size integers for InterleaveGroup.

Reviewers: Ayal, hsaito, anna, efriedma, dorit

Reviewed By: efriedma

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 355576

5 years agoRepair the build when LLDB_DISABLE_PYTHON is set
Alex Langford [Thu, 7 Mar 2019 01:02:55 +0000 (01:02 +0000)]
Repair the build when LLDB_DISABLE_PYTHON is set

Summary:
If LLDB_DISABLE_PYTHON is set, some functions are unavailable but
SBReproducer assumes they are. Let's conditionally register those functions
since they are conditionally declared.

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

llvm-svn: 355575

5 years agoAMDGPU: Handle "uniform-work-group-size" attribute (fix for RADV)
Aakanksha Patil [Thu, 7 Mar 2019 00:54:04 +0000 (00:54 +0000)]
AMDGPU: Handle "uniform-work-group-size" attribute (fix for RADV)

A previous patch for "uniform-work-group-size" attribute was found to break
some RADV and possibly radeon SI tests and had to be retracted.
This patch fixes that.

Differential Revision: http://reviews.llvm.org/D58993

llvm-svn: 355574

5 years agoAvoid using -S in combination with "script"; it's unreliable.
Adrian Prantl [Thu, 7 Mar 2019 00:46:56 +0000 (00:46 +0000)]
Avoid using -S in combination with "script"; it's unreliable.

llvm-svn: 355573

5 years agocrashlog.py: Catch exception from subprocess.
Adrian Prantl [Thu, 7 Mar 2019 00:41:51 +0000 (00:41 +0000)]
crashlog.py: Catch exception from subprocess.

llvm-svn: 355572

5 years agoRelax testcase.
Adrian Prantl [Thu, 7 Mar 2019 00:34:13 +0000 (00:34 +0000)]
Relax testcase.

Recent versions of llvm monorepo builds build libc++abi.dylib as libc++abi.1.dylib.
This accespts both variants.

llvm-svn: 355571

5 years ago[Reproducers] Add tests for different types of functionality
Jonas Devlieghere [Thu, 7 Mar 2019 00:24:44 +0000 (00:24 +0000)]
[Reproducers] Add tests for different types of functionality

This patch adds test that check that functionality in lldb continues to
work when replaying a reproducer.

 - Entries in image list are identical.
 - That stepping behaves the same.
 - That the data formatters behave the same.

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

llvm-svn: 355570

5 years agoPromote more debug-only assertions to regular assertions.
Adrian Prantl [Thu, 7 Mar 2019 00:14:20 +0000 (00:14 +0000)]
Promote more debug-only assertions to regular assertions.

llvm-svn: 355569

5 years agoPromote more debug-only assertions to regular assertions.
Adrian Prantl [Thu, 7 Mar 2019 00:10:11 +0000 (00:10 +0000)]
Promote more debug-only assertions to regular assertions.

llvm-svn: 355568

5 years ago[Python] Unbreak the recently modified tests for python 2.
Davide Italiano [Wed, 6 Mar 2019 23:50:36 +0000 (23:50 +0000)]
[Python] Unbreak the recently modified tests for python 2.

llvm-svn: 355566

5 years agoRemove the warning in
Jason Molenda [Wed, 6 Mar 2019 23:47:52 +0000 (23:47 +0000)]
Remove the warning in
DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule
which would list every kext that failed to load when doing kernel
debugging.  Instead, in DynamicLoaderDarwinKernel::ParseKextSummaries,
print a summary of how many kexts lldb was unable to load at the end.

I want to reduce the amount of output at the start of kernel debug
sessions a bit; we'll see if anyone really wanted to see the list of
which kexts specifically were unable to be loaded.

No functional change, only changing lldb's output at the start of
a kernel debug session.

<rdar://problem/48654569>

llvm-svn: 355565

5 years ago[LoopRotate] fix crash encountered with callbr
Nick Desaulniers [Wed, 6 Mar 2019 23:04:40 +0000 (23:04 +0000)]
[LoopRotate] fix crash encountered with callbr

Summary:
While implementing inlining support for callbr
(https://bugs.llvm.org/show_bug.cgi?id=40722), I hit a crash in Loop
Rotation when trying to build the entire x86 Linux kernel
(drivers/char/random.c). This is a small fix up to r353563.

Test case is drivers/char/random.c (with callbr's inlined), then ran
through creduce, then `opt -opt-bisect-limit=<limit>`, then bugpoint.

Thanks to Craig Topper for immediately spotting the fix, and teaching me
how to fish.

Reviewers: craig.topper, jyknight

Reviewed By: craig.topper

Subscribers: hiraditya, llvm-commits, srhines

Tags: #llvm

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

llvm-svn: 355564

5 years ago[PGO] Re-submit: Clang part of change for context-sensitive PGO (part2)
Rong Xu [Wed, 6 Mar 2019 23:00:38 +0000 (23:00 +0000)]
[PGO] Re-submit: Clang part of change for context-sensitive PGO (part2)

Part 2 of CSPGO change in Clang: Add test cases.

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

llvm-svn: 355563

5 years ago[testsuite] Port crashlog to python 3, second attempt.
Davide Italiano [Wed, 6 Mar 2019 22:54:11 +0000 (22:54 +0000)]
[testsuite] Port crashlog to python 3, second attempt.

llvm-svn: 355562

5 years agoFix Cmake files for ExpressionSourceCode.cpp -> ClangExpressionSourceCode.cpp.
Jim Ingham [Wed, 6 Mar 2019 22:53:38 +0000 (22:53 +0000)]
Fix Cmake files for ExpressionSourceCode.cpp -> ClangExpressionSourceCode.cpp.

llvm-svn: 355561

5 years agoFactor the clang specific parts of ExpressionSourceCode.{h,cpp} into the clang plugin.
Jim Ingham [Wed, 6 Mar 2019 22:43:25 +0000 (22:43 +0000)]
Factor the clang specific parts of ExpressionSourceCode.{h,cpp} into the clang plugin.

NFC

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

llvm-svn: 355560

5 years agoPass /bigobj for SBReproducer.cpp with MSVC
Zachary Turner [Wed, 6 Mar 2019 22:42:34 +0000 (22:42 +0000)]
Pass /bigobj for SBReproducer.cpp with MSVC

/BIGOBJ is used to bypass certain COFF file format
limitations and is used with, unsurprisingly, very big
object files.  This file has grown large enough that it
needs this flag in order to compile successfully.

llvm-svn: 355559

5 years ago[mips] Replace assertion by error message while lowering `RETURNADDR` and `FRAMEADDR`
Simon Atanasyan [Wed, 6 Mar 2019 22:40:28 +0000 (22:40 +0000)]
[mips] Replace assertion by error message while lowering `RETURNADDR` and `FRAMEADDR`

MIPS target supports lowering `RETURNADDR` and `FRAMEADDR` for a current
frame only. It's better to show an error message then crash on assertion
if `__builtin_return_address` is invoked with non-zero argument.

llvm-svn: 355558

5 years ago[lldb-vscode] Correctly propagate errors back to VS Code.
Zachary Turner [Wed, 6 Mar 2019 22:30:06 +0000 (22:30 +0000)]
[lldb-vscode] Correctly propagate errors back to VS Code.

llvm-svn: 355557

5 years ago[PGO] Fix hexagon buildbot errors in r355541
Rong Xu [Wed, 6 Mar 2019 22:16:47 +0000 (22:16 +0000)]
[PGO] Fix hexagon buildbot errors in r355541

Add "REQUIRES: x86-registered-target" to thinlto test cases.

llvm-svn: 355556

5 years ago[debugserver] Fix IsUserReady thread filtering
Frederic Riss [Wed, 6 Mar 2019 21:56:14 +0000 (21:56 +0000)]
[debugserver] Fix IsUserReady thread filtering

Summary:
In 2010 (r118866), filtering code was added to debugserver to avoid reporting threads
that were "not ready to be displayed to the user". This code inspects the thread's
state and discards threads marked 'uninterruptible'. Turns out, this state is pretty
common and not only a characterisitic of 'user-readiness'. This filtering was tracked
down as the source of the flakiness of TestQueues and TestConcurrent* with the symptom
of missing threads.

We discussed with the kernel team and there should be no need for us to filter the
restult of task_threads(). Everything that is returned from there can be examined.
So I went on and tried to remove the filtering completely. This produces other test
failures, where we were reporting more theads than expected. Always threads that had
been terminated, but weren't removed from the task bookkeeping structures yet. Those
threads always had a PC of 0.

This patch changes the heuristic to make the filtering a little less strict and only
rejects threads that are 'uninteruptible' *and* have a PC of 0. This has proven to be
solid in my testing.

Reviewers: jasonmolenda, clayborg, jingham

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 355555

5 years agoSanity check --max-gdbserver-port
Jan Kratochvil [Wed, 6 Mar 2019 21:52:19 +0000 (21:52 +0000)]
Sanity check --max-gdbserver-port

In mail
[lldb-dev] Remote debugging a docker process
https://lists.llvm.org/pipermail/lldb-dev/2019-March/014795.html
user was confused by --min-gdbserver-port and --max-gdbserver-port options
being ignored. I think there is even a bug that --max-gdbserver-port is upper
exclusive limit (and not upper inclusive limit appropriate for max).

At least this patch should catch such mistake by an error message. The question
is whether --max-gdbserver-port should not be changed to really be max and not
max+1 but that would break backward compatibility.

Now the mail example does produce:
error: --min-gdbserver-port (5001) is not lower than --max-gdbserver-port (5001)

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

llvm-svn: 355554

5 years agoPass ConstString by value (NFC)
Adrian Prantl [Wed, 6 Mar 2019 21:22:25 +0000 (21:22 +0000)]
Pass ConstString by value (NFC)

My apologies for the large patch. With the exception of ConstString.h
itself it was entirely produced by sed.

ConstString has exactly one const char * data member, so passing a
ConstString by reference is not any more efficient than copying it by
value. In both cases a single pointer is passed. But passing it by
value makes it harder to accidentally return the address of a local
object.

(This fixes rdar://problem/48640859 for the Apple folks)

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

llvm-svn: 355553

5 years agogn build: Merge r355514.
Peter Collingbourne [Wed, 6 Mar 2019 21:21:45 +0000 (21:21 +0000)]
gn build: Merge r355514.

llvm-svn: 355552

5 years ago[CUDA][HIP][DebugInfo] Skip reference device function
Michael Liao [Wed, 6 Mar 2019 21:16:27 +0000 (21:16 +0000)]
[CUDA][HIP][DebugInfo] Skip reference device function

Summary:
- A device functions could be used as a non-type template parameter in a
  global/host function template. However, we should not try to retrieve that
  device function and reference it in the host-side debug info as it's
  only valid at device side.

Subscribers: aprantl, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 355551

5 years ago[libc++] Fix use-after-free when building with _LIBCPP_DEBUG=1
Thomas Anderson [Wed, 6 Mar 2019 21:10:08 +0000 (21:10 +0000)]
[libc++] Fix use-after-free when building with _LIBCPP_DEBUG=1

The issue is the following code:

    __cn1->__add(*__ip);
    (*__ip)->__c_ = __cn1;

`__ip` points into the array of iterators for container `__cn2`.  This code adds
the iterator to the array of iterators for `__cn1`, and updates the iterator to
point to the new container.

This code works fine, except when `__cn1` and `__cn2` are the same container.
`__cn1->__add()` might need to grow the array of iterators, and when it does,
`__ip` becomes invalid, so the second line becomes a use-after-free error.

Simply swapping the order of the above two lines is not sufficient, because of
the memmove() below.  The easiest and most performant solution is just to skip
touching any iterators if the containers are the same.

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

llvm-svn: 355550

5 years agoAMDGPU: Fix the mapping of sub group sync scope
Konstantin Zhuravlyov [Wed, 6 Mar 2019 20:54:48 +0000 (20:54 +0000)]
AMDGPU: Fix the mapping of sub group sync scope

Map memory_scope_sub_group to "wavefront" sync scope

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

llvm-svn: 355549

5 years agoRemove redundant second os.path.join call [NFC]
Raphael Isemann [Wed, 6 Mar 2019 20:51:28 +0000 (20:51 +0000)]
Remove redundant second os.path.join call [NFC]

llvm-svn: 355548

5 years agoPassthrough compiler launcher
JF Bastien [Wed, 6 Mar 2019 20:36:00 +0000 (20:36 +0000)]
Passthrough compiler launcher

Summary: Not having this seems like an oversight, and makes stage2 builds odd.

Reviewers: ddunbar, dexonsmith

Subscribers: mgorny, jkorous, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 355547

5 years agoFix ABI compatibility of `<stdexcept>` with VCRuntime.
Eric Fiselier [Wed, 6 Mar 2019 20:31:57 +0000 (20:31 +0000)]
Fix ABI compatibility of `<stdexcept>` with VCRuntime.

Summary:
Currently, libc++'s `<stdexcept>` doesn't play nice with `vcruntime`. Specifically:

* `logic_error` and `runtime_error` have a different layout.
* libc++'s `logic_error` and `runtime_error` override `what()` but `vcruntime` does not.
*  `vcruntime` uses weak vtables for `<stdexcept>` types.
* libc++'s `<stdexcept>` constructors and assignment operators may have different manglings than `vcruntimes`.

This patch makes libc++'s declarations in `<stdexcept>` match those provided by MSVC's STL as closely as possible.
If MSVC doesn't declare a special member, then neither do we. This ensures that the implicit definitions have the same linkage, visibility, triviality, and noexcept-ness.

Reviewers: thomasanderson, ldionne, smeenai

Reviewed By: thomasanderson

Subscribers: jdoerfert, libcxx-commits

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

llvm-svn: 355546

5 years ago[AArch64] Improve FP16 instruction selection for vector round and vector conver from...
Abderrazek Zaafrani [Wed, 6 Mar 2019 20:30:06 +0000 (20:30 +0000)]
[AArch64] Improve FP16 instruction selection for vector round and vector conver from half instructions
https://reviews.llvm.org/D58855

llvm-svn: 355545

5 years ago[X86] Add vector mulo with power of two operand tests; NFC
Nikita Popov [Wed, 6 Mar 2019 20:25:49 +0000 (20:25 +0000)]
[X86] Add vector mulo with power of two operand tests; NFC

llvm-svn: 355544

5 years ago[LLD][COFF] More detailed information for /failifmismatch
Alexandre Ganea [Wed, 6 Mar 2019 20:18:38 +0000 (20:18 +0000)]
[LLD][COFF] More detailed information for /failifmismatch

When mismatched #pragma detect_mismatch declarations occur, now print the conflicting OBJs.

  lld-link: error: /failifmismatch: mismatch detected for 'TEST':
  >>> test.obj has value 1
  >>> test2.obj has value 2

Fixes PR38579

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

llvm-svn: 355543

5 years ago[PS4] Emit a trap after a stack-protector fail call.
Paul Robinson [Wed, 6 Mar 2019 19:57:43 +0000 (19:57 +0000)]
[PS4] Emit a trap after a stack-protector fail call.

llvm-svn: 355542

5 years ago[PGO] Context sensitive PGO (part 4)
Rong Xu [Wed, 6 Mar 2019 19:31:37 +0000 (19:31 +0000)]
[PGO] Context sensitive PGO (part 4)

Part 4 of CSPGO changes:
(1) add support in cmake for cspgo build.
(2) fix an issue in big endian.
(3) test cases.

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

llvm-svn: 355541

5 years ago[AtomicExpand] Allow libcall expansion for non-zero address spaces (try 2)
Philip Reames [Wed, 6 Mar 2019 19:27:13 +0000 (19:27 +0000)]
[AtomicExpand] Allow libcall expansion for non-zero address spaces (try 2)

Restore a reverted commit, with the silly mistake fixed.  Sorry for the previous breakage.

Be consistent about how we treat atomics in non-zero address spaces.  If we get to the backend, we tend to lower them as if in address space 0.  Do the same if we need to insert a libcall instead.

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

llvm-svn: 355540

5 years ago[NFC][TSan][libdispatch] Rename tsan_block_context_t -> block_context_t
Julian Lettner [Wed, 6 Mar 2019 19:27:10 +0000 (19:27 +0000)]
[NFC][TSan][libdispatch] Rename tsan_block_context_t -> block_context_t

'tsan_' part of the struct name is redundant since we are already inside
the __tsan namespace.

llvm-svn: 355539

5 years ago[tsan] Support interception of libdispatch on Linux
Julian Lettner [Wed, 6 Mar 2019 19:25:09 +0000 (19:25 +0000)]
[tsan] Support interception of libdispatch on Linux

This is a new attempt for bringing TSan libdispatch support to Linux.
The main issue with the last patch (https://reviews.llvm.org/D53171) was
that we want to avoid building a separate library.

The updated plan is as follows:
1) Hide libdispatch support behind a flag: true on Darwin, false
   elsewhere. If flag is specified, assume that libdispatch header and
   -flbocks is available for building. This way we can directly include
   the libdispatch header and rely on blocks runtime for our
   implementation.
2) Optionally/weakly intercept libdispatch API functions.

This patch accomplishes 1). It compiles (without the flag enabled) on
Linux. Follow-up patches will provide 2) and enabling of tests on Linux.

Reviewed By: dvyukov

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

llvm-svn: 355538