Commit Graph

347237 Commits

Author SHA1 Message Date
Nikita Popov b90ea4f341 [IRBuilder] Move some code into the cpp file; NFC
Since D73835 we no longer need to define the whole IRBuilder
implementation in the header. This patch moves some of the larger
methods out of line, into the C++ file.

Differential Revision: https://reviews.llvm.org/D77332
2020-04-04 12:52:56 +02:00
Nikita Popov 6896d559f3 [VNCoercion] Use IRBuilderBase; NFC
And remove include from header.
2020-04-04 12:44:50 +02:00
vgxbj 541bead8b4 [Object] object::ELFObjectFile::dynamic_symbol_begin(): skip symbol index 0
Summary:
Note: This revision is very similar to D62296.

In D75756, we need `getDynamicSymbolIterators()` to skip first NULL symbol in `.dynsym`. And I believe it might be worth pointing this out in a separate patch to gather you experts' opinions.

I have checked that current code base will not be affected by this change.

```
dynamic_symbol_begin()
|- dynamic_symbol_end(): Ok
`- getDynamicSymbolIterators()
   |- addDynamicElfSymbols(): llvm/tools/llvm-objdump/llvm-objdump.cpp, Line 934
   |                          Ok, NULL symbol will be omitted by Line 945-947
   |                          StringRef Name = unwrapOrError(Symbol.getName(), Obj->getName());
   |                          if (Name.empty()) continue;
   |- dumpSymbolNameFromObject(): llvm/tools/llvm-nm/llvm-nm.cpp, Line 1192
   |                          There's no test for dumping dynamic debugging symbol. This patch helps improve llvm-nm behavior. (we should add test for this later)
   `- computeSymbolSizes(): llvm/lib/Object/SymbolSize.cpp, Line 52
      |- OProfileJITEventListener::notifyObjectLoaded(): llvm/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp, Line 92
      |                                                  Ok, NULL symbol will be omitted by Line 94-95
      |                                                  if (!Sym.getType() || *Sym.getType() != SF_Function) continue;
      |- IntelJITEventListener::notifyObjectLoaded(): llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp, Line 98
      |                                               Ok, NULL symbol will be omitted by Line 124-126 (same as previous one)
      |- PerfJITEventListener::notifyObjectLoaded(): llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp, Line 244
      |                                              Ok, NULL symbol will be omitted by Line 254-256, (same as previous one)
      |- SymbolizableObjectFile::create(): llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp, Line 73
      |                                    Ok, NULL symbol will be omitted by Line 75
      |                                    res->addSymbol()
      |                                    In addSymbol(), Line 167-168
      |                                    if (!Sec || (Obj && Obj->section_end() == *Sec)) return std::error_code();
      |- dumpCXXData(): llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp, Line 189
      |                 Ok, NULL symbol will be omitted by Line 199-202
      |                 object::section_iterator SecI = *SecIOrErr;
      |                 // Skip external symbols.
      |                 if (SecI == Obj->section_end())
      |                   continue;
      `- printLineInfoForInput(): llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp, Line 418
                                  Ok, NULL symbol will be omitted by Line 430-477
                                  if (Type == object::SymbolRef::ST_Function) {
                                    ...
                                  }
```

Reviewers: grimar, jhenderson, MaskRay

Reviewed By: jhenderson, MaskRay

Subscribers: rupprecht, arphaman, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D76081
2020-04-04 18:45:52 +08:00
Nikita Popov ebd5a1b049 [Reassociate] Use IRBuilderBase; NFC
And remove now unnecessary IRBuilder.h include in header.
2020-04-04 12:34:16 +02:00
Nikita Popov 1055e9e3c8 [IVDescriptors] Remove IRBuilder.h include; NFC
IVDescriptors.h itself does not reference IRBuilder at all.
Move the include into transformation passes that do.
2020-04-04 12:07:57 +02:00
Nikita Popov a5eb1236e3 [IVDescriptors] Remove unnecessary DemandedBits.h include; NFC
Forward declare DemandedBits in IVDescriptors, and move include
into the cpp file. Also drop the include from LoopUtils, which
does not need it at all.
2020-04-04 12:07:57 +02:00
Eric Fiselier 62f3a9650a [libc++] Attempt to workaround module invalidation bug 2020-04-04 03:18:01 -04:00
Sam McCall ebd522aaa8 [clangd] Tweak parseDocumentation loop to use raw lines. NFC
This clears the way for the raw lines themselves to be parsed easily.

(Okay, one functional change: fix punctuation linebreaks with trailing WS)
2020-04-04 08:07:51 +02:00
Sam McCall a975fde23a [clang] Annotate trivial getters and setters on hover.
Summary: (Only if their definitions are visible and they have no other docs)

Reviewers: kadircet

Subscribers: jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77408
2020-04-04 07:15:12 +02:00
Frederik Gossen 1a2370bfb8 [MLIR] Fix shape inference in toy tutorial
The implementation of shape inference in the toy tutorial did not conform to the correct algorithmic description.
The result was only correct because all operations appear to be processed in sequence.

Differential Revision: https://reviews.llvm.org/D77382
2020-04-04 04:34:21 +00:00
Matt Arsenault b801577c59 AMDGPU: Fix a few more tests with old denormal subtarget features 2020-04-03 23:42:13 -04:00
Mehdi Amini 1ce0bc39ee Add mention of advantages of `arc` in the Phabricator doc.
Differential Revision: https://reviews.llvm.org/D76952
2020-04-04 03:22:29 +00:00
Richard Smith 179f4baba0 Don't treat a CXXScopeSpec with a nested name specifier but no location
as invalid.

We create those when forming trivial type source information with no
associated location, which, unfortunately, we do create in some cases
(when a TreeTransform with no base location is used to transform a
QualType).

This would previously lead to rejects-valid bugs when we misinterpreted
these constructs as having no nested-name-specifier.
2020-04-03 20:20:48 -07:00
Frederik Gossen 0f37454c72 Fix typos in toy tutorial
Fix two typos throughout the chapters.

Differential Revision: https://reviews.llvm.org/D77397
2020-04-04 03:17:24 +00:00
Kazuaki Ishizaki 4201679110 [OpenMP] NFC: Fix trivial typo
Differential Revision: https://reviews.llvm.org/D77430
2020-04-04 12:06:54 +09:00
Jim Ingham 3270748127 The thread plan list test is failing at least on Ubuntu Linux.
Mark it expected fail for now.

The test output shows that the "internal" thread listing isn't showing the
step out plan that we use to step back out of a function we're stepping into.
The internal plan listing code has nothing platform specific in it, so that
isn't the problem.

I am pretty sure the difference is that on MacOS we step into the function and then need to
step back out again so we push the internal plan the test is checking for.  But on Linux we
are able to step past the function without stepping into it.

So nothing is actually going wrong here, I just need to find a better test case where I
can ensure we are going to have to push a private plan.  It's probably better to test this
using a custom thread plan, then I can control the state of the plan stack better.

That's for Monday...
2020-04-03 20:06:11 -07:00
Walter Erquinigo 966122524b Fix LLDB debug builds
Summary:
A recent change in ThreadPlans introduced this little compilation error.
Seems to be related to the work around https://reviews.llvm.org/D76814.

Reviewers: clayborg, labath, jingham

Reviewed By: jingham

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D77450
2020-04-03 19:49:38 -07:00
River Riddle e3bb36370d [mlir][DeclarativeParser] Emit an error if a `:` follows an attribute with a non-constant type.
Summary: The attribute grammar includes an optional trailing colon type, so for attributes without a constant buildable type this will generally lead to unexpected and undesired behavior. Given that, it's better to just error out on these cases.

Differential Revision: https://reviews.llvm.org/D77293
2020-04-03 19:23:56 -07:00
Walter Erquinigo ca47ac3d5f [source maps] Fix remove, insert-after and replace
Summary:
In this diff of mine D77186 I introduce a bug in the replace operation, where I was failing fast by mistake.
Besides, a similar problem existed in the insert-after operation, where it was failing fast.

Finally, the remove operation was wrong, as it was not using the indices provided by the users.

I fixed those issues and added some tests account for cases with multiple elements in these requests.

Reviewers: labath, clayborg

Reviewed By: labath

Subscribers: mgrang, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D77324
2020-04-03 19:15:56 -07:00
River Riddle 79afdfab9a [mlir] Change the default of `mlir-print-op-on-diagnostic` to true
Summary: It is a very common user trap to think that the location printed along with the diagnostic is the same as the current operation that caused the error. This revision changes the behavior to always print the current operation, except for when diagnostics are being verified. This is achieved by moving the command line flags in IR/ to be options on the MLIRContext.

Differential Revision: https://reviews.llvm.org/D77095
2020-04-03 19:02:51 -07:00
Nemanja Ivanovic 56246b241e [NFC][PowerPC] Pre-commit a test case for D77448
Pre-committing the new test case so the review shows only the diffs.
2020-04-03 20:43:04 -05:00
Richard Smith 4ede887992 PR45402: Make the restrictions on constant evaluation of memcmp and
memchr consistent and comprehensible, and document them.

We previously allowed evaluation of memcmp on arrays of integers of any
size, so long as the call evaluated to 0, and allowed evaluation of
memchr on any array of integral type of size 1 (including enums). The
purpose of constant-evaluating these builtins is only to support
constexpr std::char_traits, so we now consistently allow them on arrays
of (possibly signed or unsigned) char only.
2020-04-03 18:26:14 -07:00
Jim Ingham 48ba745eac This test is failing on the Ubuntu bot but the bot log doesn't
capture the test stdout, so put the info I need to see in the error
message instead.
2020-04-03 18:04:02 -07:00
Eli Friedman 83fa811e5b [clang][opaque pointers] Fix up a bunch of "getType()->getElementType()"
In contexts where we know an LLVM type is a pointer, there's generally
some simpler way to get the pointee type.
2020-04-03 18:00:33 -07:00
Eli Friedman 3e5d671c19 [polly][opaque pointers] Remove use of deprecated APIs.
(See also D76269.)
2020-04-03 18:00:33 -07:00
Eli Friedman b11decc221 [clang codegen][opaque pointers] Remove use of deprecated constructor
(See also D76269.)
2020-04-03 18:00:33 -07:00
Eli Friedman 501ec31b59 [llvm-stress][opaque pointers] Remove use of deprecated constructor
(See also D76269.)
2020-04-03 18:00:33 -07:00
Eric Christopher 3ccd454c10 Fix unused variable, format, and format string warnings.
NFC.
2020-04-03 17:58:59 -07:00
Walter Erquinigo 725579379d [intel-mpx] Delete an unnecessary license header
Summary:
@labath mentioned to me that test files shouldn't have a license header.
I saw this one some days ago, so I'm doing some cleaning.

Reviewers: labath, clayborg

Subscribers: lldb-commits, labath

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D77328
2020-04-03 17:27:37 -07:00
Jim Ingham 2d658c56d5 Disable two new tests on Windows. They are failing but the logs are not helpful.
Also turn on the command trace unconditionally for TestThreadPlanCommands.py as the
tests for the Ubuntu bot don't seem to run with -t making it hard to see why this is
failing remotely.
2020-04-03 17:14:56 -07:00
LLVM GN Syncbot f9b570fbcf [gn build] Port 1d42c0db9a 2020-04-04 00:07:07 +00:00
Craig Topper 1d42c0db9a Revert "[X86] Add a Pass that builds a Condensed CFG for Load Value Injection (LVI) Gadgets"
This reverts commit c74dd640fd.

Reverting to address coding standard issues raised in post-commit
review.
2020-04-03 16:56:08 -07:00
Craig Topper a505ad58cf Revert "[X86] Add Support for Load Hardening to Mitigate Load Value Injection (LVI)"
This reverts commit 62c42e29ba

Reverting to address coding standard issues raised in post-commit
review.
2020-04-03 16:55:53 -07:00
Reid Kleckner e62dc1f625 [MS] Fix assert handling enum forward decls in hasVisibleDefinition
An enum may be considered to be a complete type if it was forward
declared. It may be declared with a fixed underlying type, or, in MSVC
compatiblity mode, with no type at all.

Previously, the code was written with special handling for fixed enums.
I generalized the code to check if the underlying integer type is known,
which should be the case when targetting the MSVC C++ ABI.

Fixes PR45409
2020-04-03 16:46:07 -07:00
Joerg Sonnenberger 98f77828a9 Avoid using std::max_align_t in pre-C++11 mode
Always depend on the compiler to have a correct implementation of
max_align_t in stddef.h and don't provide a fallback. For pre-C++11,
require __STDCPP_NEW_ALIGNMENT__ in <new> as provided by clang in all
standard modes. Adjust test cases to avoid testing or using max_align_t
in pre-C++11 mode and also to better deal with alignof(max_align_t)>16.
Document requirements of the alignment tests around natural alignment of
power-of-two-sized types.

Differential revision: https://reviews.llvm.org/D73245
2020-04-04 01:38:41 +02:00
Volodymyr Sapsai a8c8b627f2 [ObjC generics] Fix not inheriting type bounds in categories/extensions.
When a category/extension doesn't repeat a type bound, corresponding
type parameter is substituted with `id` when used as a type argument. As
a result, in the added test case it was causing errors like

> type argument 'T' (aka 'id') does not satisfy the bound ('id<NSCopying>') of type parameter 'T'

We are already checking that type parameters should be consistent
everywhere (see `checkTypeParamListConsistency`) and update
`ObjCTypeParamDecl` to have correct underlying type. And when we use the
type parameter as a method return type or a method parameter type, it is
substituted to the bounded type. But when we use the type parameter as a
type argument, we check `ObjCTypeParamType` that wasn't updated and
remains `id`.

Fix by updating not only `ObjCTypeParamDecl` UnderlyingType but also
TypeForDecl as we use the underlying type to create a canonical type for
`ObjCTypeParamType` (see `ASTContext::getObjCTypeParamType`).

This is a different approach to fixing the issue. The previous one was
02c2ab3d88 which was reverted in
4c539e8da1. The problem with the previous
approach was that `ObjCTypeParamType::desugar` was returning underlying
type for `ObjCTypeParamDecl` without applying any protocols stored in
`ObjCTypeParamType`. It caused inconsistencies in comparing types before
and after desugaring.

rdar://problem/54329242

Reviewed By: erik.pilkington

Differential Revision: https://reviews.llvm.org/D72872
2020-04-03 16:29:02 -07:00
Francis Visoiu Mistrih ba8b3052b5 [Driver] Handle all optimization-record options for Darwin LTO
clang with -flto does not handle -foptimization-record-path=<path>

This dulicates the code from ToolChains/Clang.cpp with modifications to
support everything in the same fashion.
2020-04-03 15:30:08 -07:00
Paula Toth 90eb7be6a1 [libc] Fix memcpy to adhere to qualified calls.
Summary: Switched to using the new memcpy implementation.

Reviewers: sivachandra, abrachet, gchatelet

Reviewed By: abrachet, gchatelet

Subscribers: mgorny, MaskRay, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D77277
2020-04-03 15:27:57 -07:00
Jan Kratochvil fcab66d5fe [lldb] Findtypes -gmodules fix for too many matches
Apparently the intention was to copy the condition above:
  if (types.GetSize() >= max_matches)
    break;

So that if the iteration stopped because of too many matches we do not
add even more matches in this 'Clang modules' block downward.

It was implemented by:
  SymbolFileDWARF: Unconditionally scan through clang modules. NFCish
  fe9eaadd68

Differential Revision: https://reviews.llvm.org/D77336
2020-04-04 00:15:06 +02:00
Paula Toth 1fcfd30fae [libc] Add strlen implementation.
Summary: This should fix the call to a non internal libc function.

Reviewers: sivachandra, abrachet

Reviewed By: sivachandra

Subscribers: xbolva00, mgorny, MaskRay, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D77279
2020-04-03 15:11:35 -07:00
Jim Ingham 1893065d7b Allow the ThreadPlanStackMap to hold the thread plans for threads
that were not reported by the OS plugin.  To facilitate this, move
adding/updating the ThreadPlans for a Thread to the ThreadPlanStackMap.
Also move dumping thread plans there as well.

Added some tests for "thread plan list" and "thread plan discard" since
I didn't seem to have written any originally.

Differential Revision: https://reviews.llvm.org/D76814
2020-04-03 14:56:28 -07:00
Jim Ingham 61e8e6882d Move thread plan stacks into the Process, indexed by TID.
Differential Revision: https://reviews.llvm.org/D75880
2020-04-03 14:56:28 -07:00
Jim Ingham 2c1c57a1df Make ThreadPlanTracers use TID & Process rather than Thread *.
Differential Revision: https://reviews.llvm.org/D75720
2020-04-03 14:56:28 -07:00
Jim Ingham e4598dc04a Make ThreadPlans use TID and Process, rather than Thread *.
Differential Revision: https://reviews.llvm.org/D75711
2020-04-03 14:56:28 -07:00
Louis Dionne ceb58ad61d [libc++] Lit: Add default values for most arguments of test executors 2020-04-03 17:52:41 -04:00
Alex Zinenko 340e1b2077 [mlir] LoopToStandard conversion: support "if/else" with results
Summary:
A recent extension allowed the `loop.if` operation to return results yielded by
its regions. However, such operations could not be lowered to a CFG of standard
operations because it would have required to modify the argument list of a
block, which is not allowed in a conversion pattern. Now that the conversion
infrastructure supports block creation, use it to create a block with an
argument list that dominates the operations following the `loop.if` and forward
the results as arguments of this block.

Depends On D77416

Differential Revision: https://reviews.llvm.org/D77418
2020-04-03 23:49:03 +02:00
Sanjay Patel b7397e81fe [InstCombine] add tests for freelyNegateValue with 'not'; NFC 2020-04-03 17:28:29 -04:00
Nico Weber 18a18b2001 Fix standalone clang builds after fb80b6b2d5.
When clang is built against a prebuilt LLVM, LLVM_SOURCE_DIR is
empty, which due to a cmake quirk caused list lengths to get out
of sync. Add a workaround.
2020-04-03 17:15:09 -04:00
Nick Desaulniers 9d9b8a20a8 [test] preformat test with update_llc_test_checks.py NFC
Summary:
Prior to landing D76961, preprocess via:
    $ llvm/utils/update_llc_test_checks.py \
      llvm/test/CodeGen/X86/callbr-asm-outputs.ll

Reviewers: void, MaskRay

Reviewed By: void, MaskRay

Subscribers: MaskRay, llvm-commits, srhines

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77356
2020-04-03 14:07:21 -07:00
Scott Constable 62c42e29ba [X86] Add Support for Load Hardening to Mitigate Load Value Injection (LVI)
After finding all such gadgets in a given function, the pass minimally inserts
LFENCE instructions in such a manner that the following property is satisfied:
for all SOURCE+SINK pairs, all paths in the CFG from SOURCE to SINK contain at
least one LFENCE instruction. The algorithm that implements this minimal
insertion is influenced by an academic paper that minimally inserts memory
fences for high-performance concurrent programs:

http://www.cs.ucr.edu/~lesani/companion/oopsla15/OOPSLA15.pdf

The algorithm implemented in this pass is as follows:

1. Build a condensed CFG (i.e., a GadgetGraph) consisting only of the following components:
  -SOURCE instructions (also includes function arguments)
  -SINK instructions
  -Basic block entry points
  -Basic block terminators
  -LFENCE instructions
2. Analyze the GadgetGraph to determine which SOURCE+SINK pairs (i.e., gadgets) are already mitigated by existing LFENCEs. If all gadgets have been mitigated, go to step 6.
3. Use a heuristic or plugin to approximate minimal LFENCE insertion.
4. Insert one LFENCE along each CFG edge that was cut in step 3.
5. Go to step 2.
6. If any LFENCEs were inserted, return true from runOnFunction() to tell LLVM that the function was modified.

By default, the heuristic used in Step 3 is a greedy heuristic that avoids
inserting LFENCEs into loops unless absolutely necessary. There is also a
CLI option to load a plugin that can provide even better optimization,
inserting fewer fences, while still mitigating all of the LVI gadgets.
The plugin can be found here: https://github.com/intel/lvi-llvm-optimization-plugin,
and a description of the pass's behavior with the plugin can be found here:
https://software.intel.com/security-software-guidance/insights/optimized-mitigation-approach-load-value-injection.

Differential Revision: https://reviews.llvm.org/D75937
2020-04-03 13:45:50 -07:00