Commit Graph

311431 Commits

Author SHA1 Message Date
Peter Collingbourne 480bce28ff gn build: Merge r355514.
llvm-svn: 355552
2019-03-06 21:21:45 +00:00
Michael Liao 982cbb6232 [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
2019-03-06 21:16:27 +00:00
Thomas Anderson 516d07de07 [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
2019-03-06 21:10:08 +00:00
Konstantin Zhuravlyov 3161c89a22 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
2019-03-06 20:54:48 +00:00
Raphael Isemann a4a167fb75 Remove redundant second os.path.join call [NFC]
llvm-svn: 355548
2019-03-06 20:51:28 +00:00
JF Bastien 2e754720e2 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
2019-03-06 20:36:00 +00:00
Eric Fiselier 2710d8e105 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
2019-03-06 20:31:57 +00:00
Abderrazek Zaafrani 5ced596198 [AArch64] Improve FP16 instruction selection for vector round and vector conver from half instructions
https://reviews.llvm.org/D58855

llvm-svn: 355545
2019-03-06 20:30:06 +00:00
Nikita Popov e1012e1efb [X86] Add vector mulo with power of two operand tests; NFC
llvm-svn: 355544
2019-03-06 20:25:49 +00:00
Alexandre Ganea d8ec81059e [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
2019-03-06 20:18:38 +00:00
Paul Robinson 05efe0fdc4 [PS4] Emit a trap after a stack-protector fail call.
llvm-svn: 355542
2019-03-06 19:57:43 +00:00
Rong Xu 05c0afe842 [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
2019-03-06 19:31:37 +00:00
Philip Reames 9549f7560f [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
2019-03-06 19:27:13 +00:00
Julian Lettner eacde7d2b0 [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
2019-03-06 19:27:10 +00:00
Julian Lettner 96ef52ccf0 [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
2019-03-06 19:25:09 +00:00
Mitch Phillips 318028f00f Revert "[IR][ARM] Add function pointer alignment to datalayout"
This reverts commit 2391bfca97.

This reverts rL355522 (https://reviews.llvm.org/D57335).

Kills buildbots that use '-Werror' with the following error:
	/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm/lib/IR/Value.cpp:657:7: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]

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

llvm-svn: 355537
2019-03-06 19:17:18 +00:00
Zachary Turner 8f7cfecfbf Try again to fix OSX compilation failure.
llvm-svn: 355536
2019-03-06 19:14:41 +00:00
Sanjay Patel f941631875 [AArch64] add tests for uaddsat/usubsat; NFC
The tests are copied from the sibling x86 test files.

llvm-svn: 355535
2019-03-06 19:02:01 +00:00
Amara Emerson 21f44dfe9c [AArch64] Remove a stray test from the AArch64 directory.
llvm-svn: 355534
2019-03-06 18:54:07 +00:00
Simon Pilgrim 9d6347cfc1 [DAGCombine] Improve select (not Cond), N1, N2 -> select Cond, N2, N1 fold
Move the x86 combine from D58974 into the DAGCombine VSELECT code and update the SELECT version to use the isBooleanFlip helper as well.

Requested by @spatel on D59006

llvm-svn: 355533
2019-03-06 18:52:52 +00:00
Simon Pilgrim 417f8c5be4 [PowerPC] Use real pointers instead of undef
The reduced test removed the pointer arguments, but to better survive D58017 and D58070 we need them back.

llvm-svn: 355532
2019-03-06 18:49:39 +00:00
Zachary Turner a313ec11fc Try to fix OSX compilation failure.
llvm-svn: 355531
2019-03-06 18:44:27 +00:00
Nikita Popov 884feb1b69 [InstCombine] Fold add nsw + sadd.with.overflow
Fold `add nsw` and `sadd.with.overflow` with constants if the addition
does not overflow.

Part of https://bugs.llvm.org/show_bug.cgi?id=38146.

Patch by Dan Robertson.

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

llvm-svn: 355530
2019-03-06 18:30:00 +00:00
Guozhi Wei 11308bdb43 [PPC] Adjust the computed branch offset for the possible shorter distance
In file PPCBranchSelector.cpp we tend to over estimate code size due to large
alignment and inline assembly. Usually it causes larger computed branch offset,
it is not big problem. But sometimes it may also causes smaller computed branch
offset than actual branch offset. If the offset is close to the limit of
encoding, it may cause problem at run time.
Following is a simplified example.

           actual        estimated
           address        address
 ...
bne Far      100            10c
.p2align 4
Near:        110            110
 ...
Far:        8108           8108

Actual offset:    0x8108 - 0x100 = 0x8008
Computed offset:  0x8108 - 0x10c = 0x7ffc

The computed offset is at most ((1 << alignment) - 4) bytes smaller than actual
offset. So we add this number to the offset for safety.

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

llvm-svn: 355529
2019-03-06 18:22:22 +00:00
Zachary Turner a89ce43cec Resubmit "Don't include UnixSignals.h from Host."
This was reverted because it breaks the GreenDragon bot, but
the reason for the breakage is lost, so I'm resubmitting this
now so we can find out what the problem is.

llvm-svn: 355528
2019-03-06 18:20:23 +00:00
Francis Visoiu Mistrih c01140ef1f [MC][MachO] Emit an error for emitting relocations of the form -SYM + cst
Emit an error for an unsupported relocation. mach-o relocations can't
encode the form -SYM + cst.

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

llvm-svn: 355527
2019-03-06 18:10:41 +00:00
Greg Clayton 6795eb3884 Fix core files for 32 bit architectures that are supported in ProcessELFCore.cpp
Core files need to know the size of the PRSTATUS header so that we can grab the register values that follow it. The code that figure out this size was using a hard coded list of architecture cores instead of relying on 32 or 64 bit for most cores.

The fix here fixes core files for 32 bit ARM. Prior to this the PRSTATUS header size was being returned as zero and the register values were being taken from the first bytes of the PRSTATUS struct (signo, etc).

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

llvm-svn: 355526
2019-03-06 18:04:10 +00:00
Shafik Yaghmour 641d0b8cee Adding test to cover the correct import of SourceLocation pertaining to a built-in during expression parsing
Summary: This tests a fix in the ASTImpoter.cpp to ensure that we import built-in correctly,
see differential: https://reviews.llvm.org/D58743
Once this change is merged this test should pass and should catch regressions in this feature.

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

llvm-svn: 355525
2019-03-06 18:03:54 +00:00
Krzysztof Parzyszek 9c005bbdd4 [Hexagon] Avoid creating 5-instruction packets with vgather pseudos
Change the resource usage of the vgather pseudos from SLOT0+LD to
SLOT0+SLOT1.

llvm-svn: 355524
2019-03-06 17:43:50 +00:00
Tatyana Krasnukha 1b6700eff4 Re-apply "Fix embedded Python initialization according to changes in version 3.7"
llvm-svn: 355523
2019-03-06 17:27:40 +00:00
Michael Platings 2391bfca97 [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: 355522
2019-03-06 17:24:11 +00:00
Louis Dionne 930007ba76 [libc++] Do not specify the underlying type of memory_order
Summary:
This breaks ABI for folks using -fshort-enums, and does not really buy
us anything.

http://llvm.org/PR40977

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, zoecarver

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

llvm-svn: 355521
2019-03-06 17:07:24 +00:00
Ryan Taylor 67f36903ae [AMDGPU] Add support for 64 bit buffer atomic artihmetic instructions
Summary:
This adds support for 64 bit buffer atomic arithmetic instructions but does not include
cmpswap as that depends on a fix to the way the register pairs are handled

Change-Id: Ib207ea65fb69487ccad5066ea647ae8ddfe2ce61

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 355520
2019-03-06 17:02:06 +00:00
Jonas Devlieghere 584f3a6d38 [Reproducers] Guard register macros that take lldb::thread_t on Windows
On Windows, lldb::thread_t is just a void*, so the we will try to
allocate an object of type void when deserializing. Undef this for now
until we support void* arguments.

llvm-svn: 355519
2019-03-06 16:42:33 +00:00
Jonas Devlieghere 9ebe71a4e1 [Reproducers] Don't use VLA in SBReproducer redirect
This should unbreak the Windows bot.

llvm-svn: 355518
2019-03-06 16:33:48 +00:00
Simon Pilgrim cdf95f8f07 [DAGCombiner] Enable UADDO/USUBO vector combine support
Differential Revision: https://reviews.llvm.org/D58965

llvm-svn: 355517
2019-03-06 16:11:03 +00:00
Sanjay Patel 1fefc30b08 [TargetLowering] simplify code for uaddsat/usubsat expansion; NFC
We had 2 local variable names for the same type.

llvm-svn: 355516
2019-03-06 16:06:27 +00:00
Alexander Kornienko 3d467a890e Revert "[CodeGen] Omit range checks from jump tables when lowering switches with unreachable default"
This reverts commit 2a0f2c5ef3 (r355490).

The commit causes an assertion failure when compiling LLVM code:
$ cat repro.cpp
class QQQ {
public:
  bool x() const;
  bool y() const;
  unsigned getSizeInBits() const {
    if (y() || x())
      return getScalarSizeInBits();
    return getScalarSizeInBits() * 2;
  }
  unsigned getScalarSizeInBits() const;
};
int f(const QQQ &Ty) {
  switch (Ty.getSizeInBits()) {
    case 1:
    case 8:
      return 0;
    case 16:
      return 1;
    case 32:
      return 2;
    case 64:
      return 3;
    default:
      __builtin_unreachable();
  }
}
$ clang -O2 -o repro.o repro.cpp
assert.h assertion failed at llvm/include/llvm/ADT/ilist_iterator.h:139 in llvm::ilist_iterator::reference llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, true, false>::operator*() const [OptionsT = llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, IsReverse = true, IsConst = false]: !NodePtr->isKnownSentinel()
*** Check failure stack trace: ***
    @     0x558aab4afc10  __assert_fail
    @     0x558aa885479b  llvm::ilist_iterator<>::operator*()
    @     0x558aa8854715  llvm::MachineInstrBundleIterator<>::operator*()
    @     0x558aa92c33c3  llvm::X86InstrInfo::optimizeCompareInstr()
    @     0x558aa9a9c251  (anonymous namespace)::PeepholeOptimizer::optimizeCmpInstr()
    @     0x558aa9a9b371  (anonymous namespace)::PeepholeOptimizer::runOnMachineFunction()
    @     0x558aa99a4fc8  llvm::MachineFunctionPass::runOnFunction()
    @     0x558aab019fc4  llvm::FPPassManager::runOnFunction()
    @     0x558aab01a3a5  llvm::FPPassManager::runOnModule()
    @     0x558aab01aa9b  (anonymous namespace)::MPPassManager::runOnModule()
    @     0x558aab01a635  llvm::legacy::PassManagerImpl::run()
    @     0x558aab01afe1  llvm::legacy::PassManager::run()
    @     0x558aa5914769  (anonymous namespace)::EmitAssemblyHelper::EmitAssembly()
    @     0x558aa5910f44  clang::EmitBackendOutput()
    @     0x558aa5906135  clang::BackendConsumer::HandleTranslationUnit()
    @     0x558aa6d165ad  clang::ParseAST()
    @     0x558aa6a94e22  clang::ASTFrontendAction::ExecuteAction()
    @     0x558aa590255d  clang::CodeGenAction::ExecuteAction()
    @     0x558aa6a94840  clang::FrontendAction::Execute()
    @     0x558aa6a38cca  clang::CompilerInstance::ExecuteAction()
    @     0x558aa4e2294b  clang::ExecuteCompilerInvocation()
    @     0x558aa4df6200  cc1_main()
    @     0x558aa4e1b37f  ExecuteCC1Tool()
    @     0x558aa4e1a725  main
    @     0x7ff20d56abbd  __libc_start_main
    @     0x558aa4df51c9  _start

llvm-svn: 355515
2019-03-06 15:23:50 +00:00
Francis Visoiu Mistrih b8a847c0a3 Reland "[Remarks] Refactor remark diagnostic emission in a RemarkStreamer"
This allows us to store more info about where we're emitting the remarks
without cluttering LLVMContext. This is needed for future support for
the remark section.

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

Original llvm-svn: 355507

llvm-svn: 355514
2019-03-06 15:20:13 +00:00
Strahinja Petrovic 94fccc93de [PowerPC] Add secure plt support for TLS symbols
This patch supports secure plt mode for TLS symbols.

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

llvm-svn: 355513
2019-03-06 15:00:10 +00:00
Teresa Johnson b1daf0aef6 [CGP] Avoid repeatedly building DominatorTree causing long compile-time (NFC)
Summary:
In r354298 a DominatorTree construction was added via new function
combineToUSubWithOverflow, which was subsequently restructured into
replaceMathCmpWithIntrinsic in r354689. We are hitting a very long
compile time due to this repeated construction, once per math cmp in
the function.

We shouldn't need to build the DominatorTree more than once per
function, except when a transformation invalidates it. There is already
a boolean flag that is returned from these methods indicating whether
the DT has been modified. We can simply build the DT once per
Function walk in CodeGenPrepare::runOnFunction, since any time a change
is made we break out of the Function walk and restart it.

I modified the code so that both replaceMathCmpWithIntrinsic as well as
mergeSExts (which was also building a DT) use the DT constructed by the
run method.

From -mllvm -time-passes:
Before this patch: CodeGen Prepare user time is 328s
With this patch: CodeGen Prepare user time is 21s

Reviewers: spatel

Subscribers: jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 355512
2019-03-06 14:57:40 +00:00
Francis Visoiu Mistrih 6b622ebea0 Revert "[Remarks] Refactor remark diagnostic emission in a RemarkStreamer"
This reverts commit 2e8c4997a2089f8228c843fd81b148d903472e02.

Breaks bots.

llvm-svn: 355511
2019-03-06 14:52:37 +00:00
Michal Gorny 2508fcff60 [lldb] [lit] Attempt to fix regex in toolchain-clang.test
llvm-svn: 355510
2019-03-06 14:49:48 +00:00
Pavel Labath b8093314ef Move RangeMap.h into Utility
Summary:
This file implements some general purpose data structures, and so it
belongs to the Utility module.

Reviewers: zturner, jingham, JDevlieghere, clayborg, espindola

Subscribers: emaste, mgorny, javed.absar, arichardson, MaskRay, lldb-commits

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

llvm-svn: 355509
2019-03-06 14:41:43 +00:00
Sanjay Patel 89e534746f [TargetLowering] simplify code for uaddsat/usubsat expansion; NFC
llvm-svn: 355508
2019-03-06 14:34:59 +00:00
Francis Visoiu Mistrih 9052f50cb4 [Remarks] Refactor remark diagnostic emission in a RemarkStreamer
This allows us to store more info about where we're emitting the remarks
without cluttering LLVMContext. This is needed for future support for
the remark section.

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

llvm-svn: 355507
2019-03-06 14:32:08 +00:00
Simon Pilgrim 1bdc2d1874 [DAGCombiner] Add SADDO/SSUBO combine support
Basic constant handling folds, for both scalars and vectors

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

llvm-svn: 355506
2019-03-06 14:22:21 +00:00
George Rimar 281a5beefa [llvm-objcopy] - Remove dead code. NFCI.
DecompressedSection can only be created if --decompress-debug-sections is specified.
https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/ELF/ELFObjcopy.cpp#L492

If it is specified when !zlib::isAvailable(), we error out early when parsing the options:
https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/CopyConfig.cpp#L657

What means the code I am removing in this patch is dead.

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

llvm-svn: 355505
2019-03-06 14:12:18 +00:00
Pavel Labath 89eb7bb3f6 Expose template parameters of endian specific types as class members
Summary:
This allows generic code to query these parameters, and is a common
practice in a lot of other template classes.

Reviewers: zturner, Bigcheese

Subscribers: kristina, llvm-commits

Tags: #llvm

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

llvm-svn: 355504
2019-03-06 14:09:02 +00:00
George Rimar 5f0b7d2f46 [llvm-objcopy] - Remove an excessive zlib::isAvailable() check and dead code.
There are 2 places where llvm-objcopy creates CompressedSection:

For --compress-debug-sections. It might create the compressed section from
regular here:
https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/ELF/ELFObjcopy.cpp#L486

All initially compressed sections are created as CompressedSection during reading the sections
from an object:
https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/ELF/Object.cpp#L1118
Those have DebugCompressionType::None type and a different constructor.

Case 1 has the following code in its constructor:

if (!zlib::isAvailable()) {
  CompressionType = DebugCompressionType::None;
  return;
}
(https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/ELF/Object.cpp#L267)

We can never reach that code with because would report an error much earlier:
https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/CopyConfig.cpp#L480

So the code I am removing is dead. Landing this will address the issue mentioned in https://bugs.llvm.org/show_bug.cgi?id=40886.

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

llvm-svn: 355503
2019-03-06 14:08:27 +00:00