platform/upstream/llvm.git
4 years ago[mlir] support creating memref descriptors from static shape with non-zero offset
Tobias Gysi [Wed, 12 Feb 2020 21:36:21 +0000 (22:36 +0100)]
[mlir] support creating memref descriptors from static shape with non-zero offset

This patch adapts the method MemRefDescriptor::fromStaticShape to
support static non-zero offsets. The updated method uses the
getStridesAndOffset method to extract strides and offset. The patch also
adapts the test cases since sizes and strides are now set in forward
instead of reverse order.

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

4 years ago[MLIR] Fix wrong header for mlir-cuda-runner
Valentin Clement [Wed, 12 Feb 2020 21:35:02 +0000 (22:35 +0100)]
[MLIR] Fix wrong header for mlir-cuda-runner

Just updated the wrong header probably copied from the mlir-cpu-runner

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

4 years agoFix type-dependency of bitfields in templates
Elizabeth Andrews [Wed, 12 Feb 2020 19:30:02 +0000 (11:30 -0800)]
Fix type-dependency of bitfields in templates

This patch is a follow up to 878a24ee244a24. Name of bitfields
with value-dependent width should be set as type-dependent. This
patch adds the required value-dependency check and sets the
type-dependency accordingly.

Patch fixes PR44886

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

4 years ago[TBLGEN] Fix subreg value overflow in DAGISelMatcher
Stanislav Mekhanoshin [Mon, 10 Feb 2020 21:37:00 +0000 (13:37 -0800)]
[TBLGEN] Fix subreg value overflow in DAGISelMatcher

Tablegen's DAGISelMatcher emits integers in a VBR format,
so if an integer is below 128 it can fit into a single
byte, otherwise high bit is set, next byte is used etc.
MatcherTable is essentially an unsigned char table. When
SelectionDAGISel parses the table it does a reverse translation.

In a situation when numeric value of an integer to emit is
unknown it can be emitted not as OPC_EmitInteger but as
OPC_EmitStringInteger using a symbolic name of the value.
In this situation the value should not exceed 127.

One of the situations when OPC_EmitStringInteger is used is
if we need to emit a subreg into a matcher table. However,
number of subregs can exceed 127. Currently last defined subreg
for AMDGPU is 192. That results in a silent bug in the ISel
with matcher reading from an invalid offset.

Fixed this bug to emit actual VBR encoded value for a subregs
which value exceeds 127.

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

4 years ago[docs] Minor updates to DeveloperPolicy due to svn to git
Jinsong Ji [Wed, 12 Feb 2020 21:07:40 +0000 (21:07 +0000)]
[docs] Minor updates to DeveloperPolicy due to svn to git

Reviewed By: efriedma

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

4 years ago[README] Add note on using cmake to perform the build
Evandro Menezes [Wed, 12 Feb 2020 20:21:02 +0000 (14:21 -0600)]
[README] Add note on using cmake to perform the build

Also, some spelling fixes.  Test commit.

4 years ago[OpenMP] update strings output of libomp.so [NFC]
Kelvin Li [Wed, 12 Feb 2020 20:38:54 +0000 (15:38 -0500)]
[OpenMP] update strings output of libomp.so [NFC]

Change the string from "Intel(R) OMP" to "LLVM OMP" in libomp.so

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

4 years ago[LoopExtractor] Fix legacy pass dependencies
Ehud Katz [Wed, 12 Feb 2020 20:39:21 +0000 (22:39 +0200)]
[LoopExtractor] Fix legacy pass dependencies

Fixes a memory leak of allocating `LoopInfoWrapperPass` and `DominatorTreeWrapperPass`.

4 years ago[llvm-exegesis] CombinationGenerator: don't store function_ref
Roman Lebedev [Wed, 12 Feb 2020 20:30:22 +0000 (23:30 +0300)]
[llvm-exegesis] CombinationGenerator: don't store function_ref

function_ref is non-owning, so if we get it as a parameter in constructor,
our reference goes out-of-scope as soon as constructor returns.
Instead, let's just take it as a parameter to the actual `generate()` call

4 years agoRevert "[IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas"
Erik Pilkington [Wed, 12 Feb 2020 20:02:58 +0000 (12:02 -0800)]
Revert "[IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas"

This reverts commit fafc6e4fdf3673dcf557d6c8ae0c0a4bb3184402.

Should fix ppc stage2 failure: http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/23546

Conflicts:
clang/lib/CodeGen/CGCall.cpp

4 years ago[mlir][Linalg] Refactor in preparation for automatic Linalg "named" ops.
Nicolas Vasilache [Wed, 12 Feb 2020 19:41:11 +0000 (14:41 -0500)]
[mlir][Linalg] Refactor in preparation for automatic Linalg "named" ops.

This revision prepares the ground for declaratively defining Linalg "named" ops.
Such named ops form the backbone of operations that are ubiquitous in the ML
application domain.

This revision closely related to the definition of a "Tensor Computation
Primitives Dialect" and demonstrates that ops can be expressed as declarative
configurations of the `linalg.generic` op.

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

4 years ago[lldb/Plugins] Move SymbolFileDWARFDebugMap into SymbolFileDWARF (NFCI)
Jonas Devlieghere [Wed, 12 Feb 2020 19:01:43 +0000 (11:01 -0800)]
[lldb/Plugins] Move SymbolFileDWARFDebugMap into SymbolFileDWARF (NFCI)

Move the logic for initialization and termination for
SymbolFileDWARFDebugMap into SymbolFileDWARF so that there's one
initializer for the SymbolFileDWARF plugin.

4 years ago[lldb/LibCxx] Have ExtractLibcxxStringInfo return an Optional result, NFC
Vedant Kumar [Wed, 5 Feb 2020 17:46:51 +0000 (09:46 -0800)]
[lldb/LibCxx] Have ExtractLibcxxStringInfo return an Optional result, NFC

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

4 years ago[lldb/StringPrinter] Avoid reading garbage in uninitialized strings
Vedant Kumar [Sat, 1 Feb 2020 07:18:17 +0000 (23:18 -0800)]
[lldb/StringPrinter] Avoid reading garbage in uninitialized strings

This patch fixes a few related out-of-bounds read bugs in the
string data formatters. These issues have to do with mishandling of un-
initialized strings. These manifest as ASan exceptions when debugging a
clang binary.

The first issue was that the std::string formatter treated strings in
"short mode" with length greater than the size of the inline buffer as
valid.

The second issue was that the StringPrinter facility did not check that
a full utf8 codepoint sequence can be read from the buffer (i.e. there
are some missing range checks). I took the opportunity here to delete
some untested code that was meant to deal with invalid input and replace
it with fail-on-invalid logic ([1][2][3]). This means we'll give up on
formatting an invalid string instead of guessing our way through it.

The third issue is that StringPrinter did not check that a utf8 sequence
could actually be fully read from the string payload. This one is especially
tricky as we may overflow the buffer pointer while reading the sequence.

I also noticed that the std::string formatter would spew the raw version of
the underlying ValueObject when garbage is detected. I've changed this to
just print "Summary Unavailable" instead, as we do elsewhere.

I've added regression tests for these issues to
test/functionalities/data-formatter/data-formatter-stl/libcxx/string.

[1]
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L136
[2]
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L163
[3]
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L357

rdar://59080026

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

4 years ago[lldb/TypeSystemClang] Supply trivial TypeSourceInfo to NonTypeTemplateParmDecl:...
Vedant Kumar [Wed, 22 Jan 2020 22:32:20 +0000 (14:32 -0800)]
[lldb/TypeSystemClang] Supply trivial TypeSourceInfo to NonTypeTemplateParmDecl::Create

This fixes a UBSan error seen while debugging clang:

Member call on null pointer of type 'clang::TypeSourceInfo'

rdar://58783517

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

4 years ago[AddressSanitizer] Ensure only AllocaInst is passed to dbg.declare
Vedant Kumar [Tue, 11 Feb 2020 00:22:27 +0000 (16:22 -0800)]
[AddressSanitizer] Ensure only AllocaInst is passed to dbg.declare

Various parts of the LLVM code generator assume that the address
argument of a dbg.declare is not a `ptrtoint`-of-alloca. ASan breaks
this assumption, and this results in local variables sometimes being
unavailable at -O0.

GlobalISel, SelectionDAG, and FastISel all do not appear to expect
dbg.declares to have a `ptrtoint` as an operand. This means that they do
not place entry block allocas in the usual side table reserved for local
variables available in the whole function scope. This isn't always a
problem, as LLVM can try to lower the dbg.declare to a DBG_VALUE, but
those DBG_VALUEs can get dropped for all the usual reasons DBG_VALUEs
get dropped. In the ObjC test case I'm looking at, the cause happens to
be that `replaceDbgDeclare` has hoisted dbg.declares into the entry
block, causing LiveDebugValues to "kill" the DBG_VALUEs because the
lexical dominance check fails.

To address this, I propose:

1) Have ASan (always) pass an alloca to dbg.declares (this patch). This
   is a narrow bugfix for -O0 debugging.

2) Make replaceDbgDeclare not move dbg.declares around. This should be a
   generic improvement for optimized debug info, as it would prevent the
   lexical dominance check in LiveDebugValues from killing as many
   variables.

   This means reverting llvm/r227544, which fixed an assertion failure
   (llvm.org/PR22386) but no longer seems to be necessary. I was able to
   complete a stage2 build with the revert in place.

rdar://54688991

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

4 years ago[KnownBits] Introduce anyext instead of passing a flag into zext
Jay Foad [Wed, 12 Feb 2020 13:27:28 +0000 (13:27 +0000)]
[KnownBits] Introduce anyext instead of passing a flag into zext

Summary:
This was a very odd API, where you had to pass a flag into a zext
function to say whether the extended bits really were zero or not. All
callers passed in a literal true or false.

I think it's much clearer to make the function name reflect the
operation being performed on the value we're tracking (rather than on
the KnownBits Zero and One fields), so zext means the value is being
zero extended and new function anyext means the value is being extended
with unknown bits.

NFC.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir][EDSC][Linalg] Compose linalg_matmul and vector.contract
Nicolas Vasilache [Wed, 12 Feb 2020 18:43:10 +0000 (13:43 -0500)]
[mlir][EDSC][Linalg] Compose linalg_matmul and vector.contract

Summary:
This revision allows model builder to create a linalg_matmul whose body
is a vector.contract. This shows the abstractions compose nicely.

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

4 years ago[gn build] Port 6030fe01f4e
LLVM GN Syncbot [Wed, 12 Feb 2020 18:34:39 +0000 (18:34 +0000)]
[gn build] Port 6030fe01f4e

4 years ago[llvm-exegesis] Exploring X86::OperandType::OPERAND_COND_CODE
Roman Lebedev [Wed, 12 Feb 2020 17:54:39 +0000 (20:54 +0300)]
[llvm-exegesis] Exploring X86::OperandType::OPERAND_COND_CODE

Summary:
Currently, we only have nice exploration for LEA instruction,
while for the rest, we rely on `randomizeUnsetVariables()`
to sometimes generate something interesting.
While that works, it isn't very reliable in coverage :)

Here, i'm making an assumption that while we may want to explore
multi-instruction configs, we are most interested in the
characteristics of the main instruction we were asked about.

Which we can do, by taking the existing `randomizeMCOperand()`,
and turning it on it's head - instead of relying on it to randomly fill
one of the interesting values, let's pregenerate all the possible interesting
values for the variable, and then generate as much `InstructionTemplate`
combinations of these possible values for variables as needed/possible.

Of course, that requires invasive changes to no longer pass just the
naked `Instruction`, but sometimes partially filled `InstructionTemplate`.

As it can be seen from the test, this allows us to explore
`X86::OperandType::OPERAND_COND_CODE` for instructions
that take such an operand.
I'm hoping this will greatly simplify exploration.

Reviewers: courbet, gchatelet

Reviewed By: gchatelet

Subscribers: orodley, mgorny, sdardis, tschuett, jrtc27, atanasyan, mstojanovic, andreadb, RKSimon, llvm-commits

Tags: #llvm

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

4 years agoCompletely ignore strict FP model and denormal-fp-math interaction
Matt Arsenault [Wed, 12 Feb 2020 18:26:04 +0000 (13:26 -0500)]
Completely ignore strict FP model and denormal-fp-math interaction

No behavior is going to make sense here until the default is IEEE.

4 years ago[ConstantFold][SVE] Fix constant fold for FoldReinterpretLoadFromConstPtr.
Huihui Zhang [Wed, 12 Feb 2020 18:19:03 +0000 (10:19 -0800)]
[ConstantFold][SVE] Fix constant fold for FoldReinterpretLoadFromConstPtr.

Summary:
Bail out early for scalable vectors. As global variables are not expected
to be scalable.

Use explicit call of getFixedSize() to assert on places where scalable size
doesn't make sense.

Reviewers: sdesmalen, efriedma, apazos, huntergr, willlovett

Reviewed By: sdesmalen

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years agoFix fp-model flag test failure on linux
Matt Arsenault [Wed, 12 Feb 2020 18:12:50 +0000 (10:12 -0800)]
Fix fp-model flag test failure on linux

We're still in the awkward state where IEEE is not the default
denormal mode.

4 years ago[ARCMT][NFC] Reduce #include dependencies
Nicolás Alvarez [Wed, 12 Feb 2020 15:36:29 +0000 (16:36 +0100)]
[ARCMT][NFC] Reduce #include dependencies

Replace some #includes in ARCMigrate source files with more specific includes
and forward declarations. This reduces the number of files that need to be
rebuilt when a header changes (and saves like 1 second of build time). For
example, several files no longer need to be rebuilt when the list of static
analyzer checkers(!) changes.

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

4 years agoRecommit "[SCCP] Remove forcedconstant, go to overdefined instead"
Florian Hahn [Wed, 12 Feb 2020 14:22:20 +0000 (14:22 +0000)]
Recommit "[SCCP] Remove forcedconstant, go to overdefined instead"

This version includes a fix for a set of crashes caused by marking
values depending on a yet unknown & tracked call as overdefined.

In some cases, we would later discover that the call has a constant
result and try to mark a user of it as constant, although it was already
marked as overdefined. Most instruction handlers bail out early if the
instruction is already overdefined. But that is not necessary for
CastInsts for example. By skipping values that depend on skipped
calls, we resolve the crashes and also improve the precision in some
cases (see resolvedundefsin-tracked-fn.ll).

Note that we may not skip PHI nodes that may depend on a skipped call,
but they can be safely marked as overdefined, as we bail out early if
the PHI node is overdefined.

This reverts the revert commit
a74b31a3e9cd844c7ce2087978568e3f5ec8519.

4 years ago[ARM] Extra vecreduce add with accumulate tests. NFC
David Green [Wed, 12 Feb 2020 12:24:26 +0000 (12:24 +0000)]
[ARM] Extra vecreduce add with accumulate tests. NFC

4 years ago[NFC] Remove extra headers included in Loop Unroll and LoopUnrollAndJam files
Anh Tuyen Tran [Wed, 12 Feb 2020 17:57:56 +0000 (17:57 +0000)]
[NFC] Remove extra headers included in Loop Unroll and LoopUnrollAndJam files

Summary:
This refactor patch removes some header files which are not needed and also add some to meet IWYU principles.

Reviewers: rnk (Reid Kleckner), Meinersbur (Michael Kruse), dmgreen (Dave Green)

Reviewed By: dmgreen (Dave Green), rnk (Reid Kleckner), Meinersbur (Michael Kruse)

Subscribers: dmgreen (Dave Green), Whitney (Whitney Tsang), hiraditya (Aditya Kumar), zzheng (Z. Zheng), llvm-commits, LLVM

Tag: LLVM

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

4 years ago[mlir] Allow constructing a ValueRange from an ArrayRef<BlockArgument>
River Riddle [Wed, 12 Feb 2020 17:46:21 +0000 (09:46 -0800)]
[mlir] Allow constructing a ValueRange from an ArrayRef<BlockArgument>

Summary: This was a missed case when ValueRange was originally added, and allows for constructing a ValueRange from the arguments of a block.

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

4 years ago[runtimes] Add umbrella targets for runtimes
Shoaib Meenai [Wed, 12 Feb 2020 02:24:57 +0000 (18:24 -0800)]
[runtimes] Add umbrella targets for runtimes

This will create e.g. a compiler-rt target that'll build compiler-rt for
all configured targets, similar to how the runtimes umbrella target
builds all the runtimes for all configured targets.

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

4 years agoFix `-Wunused-variable` warning. NFC.
Michael Liao [Wed, 12 Feb 2020 17:43:51 +0000 (12:43 -0500)]
Fix `-Wunused-variable` warning. NFC.

4 years ago[AArch64][GlobalISel] Properly implement widening for TB(N)Z
Jessica Paquette [Tue, 11 Feb 2020 18:22:38 +0000 (10:22 -0800)]
[AArch64][GlobalISel] Properly implement widening for TB(N)Z

When we have to widen to a 64-bit register, we have to emit a SUBREG_TO_REG.

Add a general-purpose widening helpe  which emits the correct SUBREG_TO_REG
instruction based off of a desired size and add a testcase.

Also remove some asserts which are technically incorrect in `emitTestBit`.

- p0 doesn't count as a scalar type, so we need to check `!Ty.isVector()`
instead

- Whenever we have a s1, the Size/Bit checks are too conservative, so just
remove them

Replace these asserts with less conservative ones where applicable.

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

4 years agoCompute ORE, BPI, BFI in Loop passes.
Alina Sbirlea [Thu, 16 Jan 2020 23:32:30 +0000 (15:32 -0800)]
Compute ORE, BPI, BFI in Loop passes.

Summary:
Passes ORE, BPI, BFI are not being preserved by Loop passes, hence it
is incorrect to retrieve these passes as cached.
This patch makes the loop passes in question compute a new instance.

In some of these cases, however, it may be beneficial to change the Loop pass to
a Function pass instead, similar to the change for LoopUnrollAndJam.

Reviewers: chandlerc, dmgreen, jdoerfert, reames

Subscribers: mehdi_amini, hiraditya, zzheng, steven_wu, dexonsmith, Whitney, llvm-commits

Tags: #llvm

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

4 years agoclang: Guess at some platform FTZ/DAZ default settings
Matt Arsenault [Fri, 8 Nov 2019 01:14:51 +0000 (17:14 -0800)]
clang: Guess at some platform FTZ/DAZ default settings

This is to avoid performance regressions when the default attribute
behavior is fixed to assume ieee.

I tested the default on x86_64 ubuntu, which seems to default to
FTZ/DAZ, but am guessing for x86 and PS4.

4 years ago[VectorCombine] add tests for extract-binop; NFC
Sanjay Patel [Wed, 12 Feb 2020 16:33:21 +0000 (11:33 -0500)]
[VectorCombine] add tests for extract-binop; NFC

4 years agoFix SFINAE in llvm::bit_cast.
Justin Lebar [Tue, 11 Feb 2020 03:34:44 +0000 (19:34 -0800)]
Fix SFINAE in llvm::bit_cast.

Summary:
As far as I can tell, the SFINAE was broken; there is no such thing as
std::is_trivially_constructible<T>::type.

Subscribers: dexonsmith, llvm-commits

Tags: #llvm

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

4 years agoFix compilation of Any.h header.
Justin Lebar [Wed, 12 Feb 2020 16:05:00 +0000 (08:05 -0800)]
Fix compilation of Any.h header.

In a previous patch I changed `std::decay<T>::type` to `std::decay<T>`
rather than `std::decay_t<T>`.  This seems to have broken the build
*only for clang-cl*.  I don't know why.

Submitting with post-commit review because this is an obvious fix for a
build breakage and we've verified that it fixes the breakage.

4 years ago[ELF] Support INSERT [AFTER|BEFORE] for orphan sections
Fangrui Song [Mon, 10 Feb 2020 23:58:29 +0000 (15:58 -0800)]
[ELF] Support INSERT [AFTER|BEFORE] for orphan sections

D43468+D44380 added INSERT [AFTER|BEFORE] for non-orphan sections. This patch
makes INSERT work for orphan sections as well.

`SECTIONS {...} INSERT [AFTER|BEFORE] .foo` does not set `hasSectionCommands`, so the result
will be similar to a regular link without a linker script. The differences when `hasSectionCommands` is set include:

* image base is different
* -z noseparate-code/-z noseparate-loadable-segments are unavailable
* some special symbols such as `_end _etext _edata` are not defined

The behavior is similar to GNU ld:
INSERT is not considered an external linker script.

This feature makes the section layout more flexible. It can be used to:

* Place .nv_fatbin before other readonly SHT_PROGBITS sections to mitigate relocation overflows.
* Disturb the layout to expose address sensitive application bugs.

Reviewed By: grimar

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

4 years ago[ELF] Start a new PT_LOAD if LMA region is different
Fangrui Song [Sun, 9 Feb 2020 06:04:06 +0000 (22:04 -0800)]
[ELF] Start a new PT_LOAD if LMA region is different

GNU ld has a counterintuitive lang_propagate_lma_regions rule.

```
// .foo's LMA region is propagated to .bar because their VMA region is the same,
// and .bar does not have an explicit output section address (addr_tree).
.foo : { *(.foo) } >RAM AT> FLASH
.bar : { *(.bar) } >RAM

// An explicit output section address disables propagation.
.foo : { *(.foo) } >RAM AT> FLASH
.bar . : { *(.bar) } >RAM
```

In both cases, lld thinks .foo's LMA region is propagated and
places .bar in the same PT_LOAD, so lld diverges from GNU ld w.r.t. the
second case (lma-align.test).

This patch changes Writer<ELFT>::createPhdrs to disable propagation
(start a new PT_LOAD). A user of the first case can make linker scripts
portable by explicitly specifying `AT>`. By contrast, there was no
workaround for the old behavior.

This change uncovers another LMA related bug in assignOffsets() where
`ctx->lmaOffset = 0;` was omitted. It caused a spurious "load address
range overlaps" error for at2.test

The new PT_LOAD rule is complex. For convenience, I listed the origins of some subexpressions:

* rL323449: `sec->memRegion == load->firstSec->memRegion`; linkerscript/at3.test
* D43284: `load->lastSec == Out::programHeaders` (don't start a new PT_LOAD after program headers); linkerscript/at4.test
* D58892: `sec != relroEnd` (start a new PT_LOAD after PT_GNU_RELRO)

Reviewed By: psmith

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

4 years ago[ELF] Respect output section alignment for AT> (non-null lmaRegion)
Fangrui Song [Sat, 8 Feb 2020 19:07:03 +0000 (11:07 -0800)]
[ELF] Respect output section alignment for AT> (non-null lmaRegion)

When lmaRegion is non-null, respect `sec->alignment`
This rule is analogous to `switchTo(sec)` which advances sh_addr (VMA).

This fixes the p_paddr misalignment issue as reported by
https://android-review.googlesource.com/c/trusty/external/trusted-firmware-a/+/1230058

Note, `sec->alignment` is the maximum of ALIGN and input section alignments. We may overalign LMA than GNU ld.

linkerscript/align-lma.s has a FIXME that demonstrates another bug:
`.bss ... >RAM` should be placed in a different PT_LOAD (GNU ld
behavior) because its lmaRegion (nullptr) is different from the previous
section's lmaRegion (ROM).

Reviewed By: psmith

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

4 years ago[llvm-objdump] Print file format in lowercase to match GNU output.
Jordan Rupprecht [Tue, 11 Feb 2020 19:55:40 +0000 (11:55 -0800)]
[llvm-objdump] Print file format in lowercase to match GNU output.

Summary:
GNU objdump prints the file format in lowercase, e.g. `elf64-x86-64`. llvm-objdump prints `ELF64-x86-64` right now, even though piping that into llvm-objcopy refuses that as a valid arch to use.

As an example of a problem this causes, see: https://github.com/ClangBuiltLinux/linux/issues/779

Reviewers: MaskRay, jhenderson, alexshap

Reviewed By: MaskRay

Subscribers: tpimh, sbc100, grimar, jvesely, nhaehnle, kerbowa, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[X86] combineFneg - generalize FMA negations with isNegatibleForFree/getNegatedExpression
Simon Pilgrim [Wed, 12 Feb 2020 16:07:16 +0000 (16:07 +0000)]
[X86] combineFneg - generalize FMA negations with isNegatibleForFree/getNegatedExpression

This has a really interesting side effect in that it improves some UMAX/UMIN reduction code which had redundant XOR(SHUFFLE(XOR(X,SIGNMASK)),SIGNMASK) patterns - the getNegatibleCost recognises it as FNEG(SHUFFLE(FNEG(X))).... We have a lot of FNEG patterns bitcasted to the integer domain for XOR signbit twiddling which is similar to what we do to allow UMAX/UMIN to be lowered using SMAX/SMIN.

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

4 years agoAdd missing newlines at EOF; NFC
Sven van Haastregt [Wed, 12 Feb 2020 15:57:25 +0000 (15:57 +0000)]
Add missing newlines at EOF; NFC

4 years ago[clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.
Haojian Wu [Wed, 12 Feb 2020 08:47:31 +0000 (09:47 +0100)]
[clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.

Reviewers: gribozavr2

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

4 years agoTitle: [TSAN] Parameterize the hard-coded threshold of deflake in tsan test
Anh Tuyen Tran [Wed, 12 Feb 2020 15:51:57 +0000 (15:51 +0000)]
Title: [TSAN] Parameterize the hard-coded threshold of deflake in tsan test

Summary:
A number of testcases in TSAN are designed to deal with intermittent problems
not exist in all executions of the tested program. A script called deflake.bash
runs the executable up to 10 times to deal with the intermittent nature of the tests.

The purpose of this patch is to parameterize the hard-coded threshold above via
--cmake_variables=-DTSAN_TEST_DEFLAKE_THRESHOLD=SomeIntegerValue
When this cmake var is not set, the default value of 10 will be used.

Reviewer: dvyukov (Dmitry Vyukov), eugenis (Evgenii Stepanov), rnk (Reid Kleckner), hubert.reinterpretcast (Hubert Tong), vitalybuka (Vitaly Buka)

Reviewed By: vitalybuka (Vitaly Buka)

Subscribers: mgorny (Michal Gorny), jfb (JF Bastien), steven.zhang (qshanz), llvm-commits (Mailing List llvm-commits), Sanitizers

Tag: LLVM, Sanitizers

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

4 years ago[libc++][Apple] Use CLOCK_MONOTONIC_RAW instead of CLOCK_UPTIME_RAW for steady_clock
Louis Dionne [Mon, 10 Feb 2020 17:30:43 +0000 (18:30 +0100)]
[libc++][Apple] Use CLOCK_MONOTONIC_RAW instead of CLOCK_UPTIME_RAW for steady_clock

Summary:
In D27429, we switched the Apple implementation of steady_clock::now()
from clock_gettime(CLOCK_MONOTONIC) to clock_gettime(CLOCK_UPTIME_RAW).
The purpose was to get nanosecond precision, and also to improve the
performance of the implementation.

However, it appears that CLOCK_UPTIME_RAW does not satisfy the requirements
of the Standard, since it is not strictly speaking monotonic. Indeed, the
clock does not increment while the system is asleep, which had been
mentioned in D27429 but somehow not addressed.

This patch switches to CLOCK_MONOTONIC_RAW, which is monotonic, increased
during sleep, and also has nanosecond precision.

https://llvm.org/PR44773

Reviewers: bruno, howard.hinnant, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF

Tags: #libc

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

4 years ago[AArch64][SVE] Add addsub carry long instrinsics
Danilo Carvalho Grael [Wed, 12 Feb 2020 15:36:15 +0000 (10:36 -0500)]
[AArch64][SVE] Add addsub carry long instrinsics

Summary:
Add intrinsics for the following instructions:
- adclb, adclt, sbclb, sbclt

Reviewers: kmclaughlin, c-rhodes, sdesmalen, efriedma, rengolin

Reviewed By: kmclaughlin

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years agoRevert "Revert "Change clang option -ffp-model=precise to select ffp-contract=on""
Melanie Blower [Tue, 11 Feb 2020 22:40:23 +0000 (14:40 -0800)]
Revert "Revert "Change clang option -ffp-model=precise to select ffp-contract=on""

This reverts commit 99c5bcbce89f07e68ccd89891a0300346705d013.
Change clang option -ffp-model=precise to select ffp-contract=on
Including some small touch-ups to the original commit

Reviewers: rjmccall, Andy Kaylor

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

4 years ago[PowerPC] Add options for PPC to enable/disable using non-volatile CR
Victor Huang [Wed, 12 Feb 2020 15:22:36 +0000 (09:22 -0600)]
[PowerPC] Add options for PPC to enable/disable using non-volatile CR

An option is added for PowerPC to disable use of non-volatile CR
register fields and avoid CR spilling in the prologue.

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

4 years ago[libc++] span: Guard against overflow in span::subspan
Louis Dionne [Wed, 12 Feb 2020 15:20:09 +0000 (16:20 +0100)]
[libc++] span: Guard against overflow in span::subspan

The calculation _Offset + _Count <= size() may overflow, so use
_Count <= size() - _Offset instead. Note that this is safe due to
the previous constraint that _Offset <= size().

Patch by Michael Schellenberger Costa.

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

4 years ago[PowerPC] Add support for intrinsic llvm.ppc.eieio
Anil Mahmud [Mon, 3 Feb 2020 18:34:44 +0000 (12:34 -0600)]
[PowerPC] Add support for intrinsic llvm.ppc.eieio

Add support for the intrinsic llvm.ppc.eieio to emit the instruction eieio.

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

4 years ago[PowerPC] Add support for intrinsics llvm.ppc.dcbfl and llvm.ppc.dcbflp
Anil Mahmud [Mon, 3 Feb 2020 17:03:54 +0000 (11:03 -0600)]
[PowerPC] Add support for intrinsics llvm.ppc.dcbfl and llvm.ppc.dcbflp

Added support for the intrinsic llvm.ppc.dcbfl and llvm.ppc.dcbflp.
These will be used for emitting cache control instructions dcbfl and dcbflp
which are actually mnemonics for using dcbf instruction with different
immediate arguments.

dcbfl ra, rb -> dcbf ra, rb, 1
dcbflp, ra, rb -> dcbf ra, rb, 3

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

4 years agoAMDGPU/GlobalISel: Split 96-bit load/store select tests out
Matt Arsenault [Wed, 12 Feb 2020 14:56:36 +0000 (09:56 -0500)]
AMDGPU/GlobalISel: Split 96-bit load/store select tests out

These are only legal on CI+. The test would fail in a debug build, but
not a release due to the partial selection since the pre-selection
legality assert only happens in a debug build.

4 years ago[MC][AVR] Fix AVR test following 740bc366
James Henderson [Wed, 12 Feb 2020 14:56:09 +0000 (14:56 +0000)]
[MC][AVR] Fix AVR test following 740bc366

4 years ago[DebugInfo] Add checks for v2 directory and file name table terminators
James Henderson [Wed, 12 Feb 2020 14:37:10 +0000 (14:37 +0000)]
[DebugInfo] Add checks for v2 directory and file name table terminators

The DWARFv2-4 specification for the line table header states that the
include directories and file name tables both end with a single null
byte. Prior to this change, the parser did not detect if this byte was
missing, because it also stopped reading the tables once it reached the
prologue end, as claimed by the header_length field. This change adds a
check that the terminator has been seen at the end of each table.

Reviewed by: dblaikie, MaskRay

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

4 years ago[DebugInfo] Add check for zero debug line opcode_base
James Henderson [Tue, 11 Feb 2020 12:17:33 +0000 (12:17 +0000)]
[DebugInfo] Add check for zero debug line opcode_base

The number of standard opcodes is defined to be opcode_base - 1, so a
value of 0 for the opcode_base caused a crash as an attempt was made to
reserve many entries in a vector. This change fixes the crash, by
issuing a warning and skipping reading of standard opcode lengths in the
event of an opcode_base of 0.

Reviewed by: dblaikie

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

4 years ago[DebugInfo] Print version in error message in decimal
James Henderson [Tue, 11 Feb 2020 14:11:01 +0000 (14:11 +0000)]
[DebugInfo] Print version in error message in decimal

Also remove some test duplication and add a test case that shows the
maximum version is rejected (this also shows that the value in the error
message is actually in decimal, and not just missing an 0x prefix).

Reviewed by: dblaikie

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

4 years agoRe-reapply: Recover debug intrinsics when killing duplicated/empty blocks
stozer [Wed, 12 Feb 2020 13:41:18 +0000 (13:41 +0000)]
Re-reapply: Recover debug intrinsics when killing duplicated/empty blocks

This reverts commit 636c93ed11a5f98b5c3ff88241460d61cb7785bb.

The original patch caused build failures on TSan buildbots. Commit 6ded69f294a9
fixes this issue by reducing the rate at which empty debug intrinsics
propagate, reducing the memory footprint and preventing a fatal spike.

4 years agoAMDGPU/GlobalISel: Widen non-power-of-2 load results
Matt Arsenault [Tue, 21 Jan 2020 18:23:45 +0000 (13:23 -0500)]
AMDGPU/GlobalISel: Widen non-power-of-2 load results

Load extra bits if suitably aligned. This allows using widened
3-vector loads on SI, and fixes legalization for <9 x s32> (which LSV
apparently forms frequently on lowered kernel argument lists).

Fix incorrectly treating these as legal on SI. This should emit a
64-bit store and a 32-bit store.

I think all of the load and store rules are just about complete, but
due for a rewrite.

4 years ago[Concepts] Add missing TPA commit to requires expression parsing
Saar Raz [Wed, 12 Feb 2020 14:23:55 +0000 (16:23 +0200)]
[Concepts] Add missing TPA commit to requires expression parsing

If an error had occurred when annotating a scope spec during the tentative parse
for a type-requirement, we would not revert nor commit the tentative parse, triggerring
an assertion failure.

Commit the TPA in this case and then do error recovery.

4 years agoRecommit "[DSE] Add first version of MemorySSA-backed DSE (Bottom up walk)."
Florian Hahn [Tue, 11 Feb 2020 18:27:41 +0000 (18:27 +0000)]
Recommit "[DSE] Add first version of MemorySSA-backed DSE (Bottom up walk)."

This includes a fix for the santizier failures.

This reverts the revert commit
42f8b915eb72364cc5e84adf58a2c2d4947e8b10.

4 years ago[mlir] Linalg fusion: ignore indexed_generic producers
Alex Zinenko [Wed, 12 Feb 2020 14:08:38 +0000 (15:08 +0100)]
[mlir] Linalg fusion: ignore indexed_generic producers

They are currently not supported and we should not attempt fusing them.

4 years ago[mlir] StdToLLVM: Add error when the sourceMemRef of a subview is not a llvm type.
Pierre Oechsel [Wed, 12 Feb 2020 09:26:01 +0000 (10:26 +0100)]
[mlir] StdToLLVM: Add error when the sourceMemRef of a subview is not a llvm type.

A memref_cast casting to a memref with a non identity map can't be
lowered to llvm. Take the following case:

```

func @invalid_memref_cast(%arg0: memref<?x?xf64>) {
  %c1 = constant 1 : index
  %c0 = constant 0 : index
  %5 = memref_cast %arg0 : memref<?x?xf64> to memref<?x?xf64, #map1>
  %25 = std.subview %5[%c0, %c0][%c1, %c1][] : memref<?x?xf64, #map1> to memref<?x?xf64, #map1>
  return
}
```

When lowering the subview mlir was assuming `%5` to have an llvm type
(which is not the case as mlir failed to lower the memref_cast).

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

4 years agoFix unused function warning (PR44808)
Hans Wennborg [Wed, 12 Feb 2020 14:12:31 +0000 (15:12 +0100)]
Fix unused function warning (PR44808)

4 years ago[MLIR][CUDA] Fix build file for mlir-cuda-runner
Stephan Herhut [Wed, 12 Feb 2020 13:35:32 +0000 (14:35 +0100)]
[MLIR][CUDA] Fix build file for mlir-cuda-runner

Summary:
This was broken recently when moving from dialect registration via
static initializers to explicit intialization.

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

4 years ago[Concepts] Do not check constraints if not all template arguments have been deduced
Saar Raz [Wed, 12 Feb 2020 13:58:51 +0000 (15:58 +0200)]
[Concepts] Do not check constraints if not all template arguments have been deduced

We previously checked the constraints of instantiated function templates even in cases where
PartialOverloading was true and not all template arguments have been deduced, which caused crashes
in clangd (bug 44714).

We now check if all arguments have been deduced before checking constraints in partial overloading
scenarios.

4 years ago[AggressiveInstCombine] Add test with baseline CHECKs for aggressive inst combine...
Ayman Musa [Wed, 12 Feb 2020 13:00:25 +0000 (15:00 +0200)]
[AggressiveInstCombine] Add test with baseline CHECKs for aggressive inst combine for ICmp instruction.

4 years ago[libcxx] Don't assume cwd name in std::filesystem tests
Sergej Jaskiewicz [Wed, 12 Feb 2020 13:07:30 +0000 (16:07 +0300)]
[libcxx] Don't assume cwd name in std::filesystem tests

Summary:
In `std::filesystem::proximate` tests we assume that the current working directory's name
is `fs.op.proximate`. This is fine when we're running the tests locally.

However, if we're running those tests on a remote machine via SSH, the directory layout may be
different. For example, currently we copy each test executable individually into
a temporary directory on the target board using SCP, so the assumption about the working directory name
doesn't necessarily hold.

This patch is the only thing that is necessary for all libc++ tests to pass when run remotely.

Reviewers: ldionne, EricWF, mclow.lists

Reviewed By: ldionne, EricWF

Subscribers: christof, dexonsmith, libcxx-commits

Tags: #libc

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

4 years agoRevert "[AggressiveInstCombine] Add support for ICmp instr that feeds a select intsr...
Ayman Musa [Wed, 12 Feb 2020 13:04:49 +0000 (15:04 +0200)]
Revert "[AggressiveInstCombine] Add support for ICmp instr that feeds a select intsr's condition operand."

This reverts commit cf155150f992270c88e586ffc61973d2552b72e8.

4 years ago[AggressiveInstCombine] Add support for ICmp instr that feeds a select intsr's condit...
Ayman Musa [Wed, 12 Feb 2020 12:33:31 +0000 (14:33 +0200)]
[AggressiveInstCombine] Add support for ICmp instr that feeds a select intsr's condition operand.

4 years ago[mlir][spirv] Introduce spv.func
Lei Zhang [Fri, 7 Feb 2020 16:30:19 +0000 (11:30 -0500)]
[mlir][spirv] Introduce spv.func

Thus far we have been using builtin func op to model SPIR-V functions.
It was because builtin func op used to have special treatment in
various parts of the core codebase (e.g., pass pipelines, etc.) and
it's easy to bootstrap the development of the SPIR-V dialect. But
nowadays with general op concepts and region support we don't have
such limitations and it's time to tighten the SPIR-V dialect for
completeness.

This commits introduces a spv.func op to properly model SPIR-V
functions. Compared to builtin func op, it can provide the following
benefits:

* We can control the full op so we can integrate SPIR-V information
  bits (e.g., function control) in a more integrated way and define
  our own assembly form and enforcing better verification.
* We can have a better dialect and library boundary. At the current
  moment only functions are modelled with an external op. With this
  change, all ops modelling SPIR-V concpets will be spv.* ops and
  registered to the SPIR-V dialect.
* We don't need to special-case func op anymore when creating
  ConversionTarget declaring SPIR-V dialect as legal. This is quite
  important given we'll see more and more conversions in the future.

In the process, bumps a few FuncOp methods to the FunctionLike trait.

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

4 years agoReapply "[DebugInfo] Prevent explosion of debug intrinsics during jump threading"
stozer [Wed, 12 Feb 2020 11:48:20 +0000 (11:48 +0000)]
Reapply "[DebugInfo] Prevent explosion of debug intrinsics during jump threading"

This reverts commit 6ded69f294a9a62a68b0a07aa987c8165a4b31e7.

4 years agoFix MLIR build when the NVPTX target isn't configured
Mehdi Amini [Wed, 12 Feb 2020 10:06:50 +0000 (10:06 +0000)]
Fix MLIR build when the NVPTX target isn't configured

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

4 years ago[unittests] Fix TargetLibraryInfoTest.ValidProto
Ehud Katz [Wed, 12 Feb 2020 12:13:14 +0000 (14:13 +0200)]
[unittests] Fix TargetLibraryInfoTest.ValidProto

4 years ago[AggressiveInstCombine] Add support for select instruction.
Ayman Musa [Tue, 28 Jan 2020 13:17:15 +0000 (15:17 +0200)]
[AggressiveInstCombine] Add support for select instruction.

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

4 years ago[TargetLowering] Add NegatibleCost enum for isNegatibleForFree return codes
Simon Pilgrim [Wed, 12 Feb 2020 11:42:25 +0000 (11:42 +0000)]
[TargetLowering] Add NegatibleCost enum for isNegatibleForFree return codes

The isNegatibleForFree/getNegatedExpression methods currently rely on a raw char value to indicate whether a negation is beneficial or not.

This patch replaces the char return value with an NegatibleCost enum to more clearly demonstrate what is implied.

It also renames isNegatibleForFree to getNegatibleCost to more accurately reflect whats going on.

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

4 years ago[analyzer]StreamChecker refactoring (NFC).
Balázs Kéri [Wed, 12 Feb 2020 10:26:38 +0000 (11:26 +0100)]
[analyzer]StreamChecker refactoring (NFC).

Reviewers: Szelethus

Reviewed By: Szelethus

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

Tags: #clang

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

4 years ago[lldb/DWARF] Use DWARFDebugInfoEntry * in ElaboratingDIEIterator
Pavel Labath [Wed, 12 Feb 2020 11:47:43 +0000 (12:47 +0100)]
[lldb/DWARF] Use DWARFDebugInfoEntry * in ElaboratingDIEIterator

This is simpler, faster, and sufficient to uniquely idenify a DIE.

4 years agoRevert "[DebugInfo] Prevent explosion of debug intrinsics during jump threading"
stozer [Wed, 12 Feb 2020 11:47:01 +0000 (11:47 +0000)]
Revert "[DebugInfo] Prevent explosion of debug intrinsics during jump threading"

This reverts commit fe6f6cd6b8e647c5b4ac82f4fcd56c057c2ef8ce.

Found test failure on several buildbots.

4 years ago[NFC][AggressiveInstCombine] Remove redundant std::max.
Ayman Musa [Wed, 12 Feb 2020 11:40:40 +0000 (13:40 +0200)]
[NFC][AggressiveInstCombine] Remove redundant std::max.

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

4 years ago[LLDB] Fix GCC warnings about extra semicolons. NFC.
Martin Storsjö [Wed, 12 Feb 2020 09:22:26 +0000 (11:22 +0200)]
[LLDB] Fix GCC warnings about extra semicolons. NFC.

4 years ago[DebugInfo] Prevent explosion of debug intrinsics during jump threading
stozer [Mon, 27 Jan 2020 16:05:34 +0000 (16:05 +0000)]
[DebugInfo] Prevent explosion of debug intrinsics during jump threading

This patch is a fix following the revert of 72ce759
(https://reviews.llvm.org/rG72ce759928e6dfee6a9efa310b966c19722352ba)
and fixes the failure that it caused.

The above patch failed on the Thread Sanitizer buildbot with an out of
memory error. After an investigation, the cause was identified as an
explosion in debug intrinsics while running the Jump Threading pass on
ModuleMap.ll. The above patched prevented debug intrinsics from being
dropped when their Basic Block was deleted due to being "empty". In this
case, one of the functions in ModuleMap.ll had (after many optimization
passes) a very large number of debug intrinsics representing a set of
repeatedly inlined variables. Previously the vast majority of these were
silently dropped during Jump Threading when their blocks were deleted,
but as of the above patch they survived for longer, causing a large
increase in the number of debug intrinsics. These intrinsics were then
repeatedly cloned by the Jump Threading pass as edges were threaded,
multiplying the intrinsic count further. The memory consumed by this
process spiralled out of control, crashing the buildbot that uses TSan
(which has an estimated 5-10x memory overhead compared to non-sanitized
builds).

This patch adds RemoveRedundantDbgInstrs to the Jump Threading pass, in
order to reduce the number of debug intrinsics down to a manageable
amount in cases where many intrinsics for the same variable end up
bunched together contiguously, as in this case.

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

4 years ago[ConstantFolding] Fold calls to FP remainder function
Ehud Katz [Wed, 12 Feb 2020 11:14:09 +0000 (13:14 +0200)]
[ConstantFolding] Fold calls to FP remainder function

With the fixed implementation of the "remainder" operation in
rG9d0956ebd471, we can now add support to folding calls to it.

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

4 years ago[AMDGPU] Add one more pass to LLVMInitializeAMDGPUTarget
Jay Foad [Wed, 12 Feb 2020 11:15:56 +0000 (11:15 +0000)]
[AMDGPU] Add one more pass to LLVMInitializeAMDGPUTarget

4 years ago[DebugInfo][test][NFC] Remove case numbers
James Henderson [Tue, 11 Feb 2020 13:33:29 +0000 (13:33 +0000)]
[DebugInfo][test][NFC] Remove case numbers

This reduces the noise caused by adding cases earlier in the sequence.

Reviewed by: dblaikie

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

4 years agoRevert "[DebugInfo] Enable the debug entry values feature by default"
Djordje Todorovic [Wed, 12 Feb 2020 10:54:29 +0000 (11:54 +0100)]
Revert "[DebugInfo] Enable the debug entry values feature by default"

This reverts commit rG9f6ff07f8a39.

Found a test failure on clang-with-thin-lto-ubuntu buildbot.

4 years ago[llvm-objdump] Add column headers for relocation printing
Liad Mordekoviz [Tue, 11 Feb 2020 11:10:57 +0000 (11:10 +0000)]
[llvm-objdump] Add column headers for relocation printing

This allows us better readability and compatibility with what GNU
objdump prints.

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

Reviewed by: jhenderson, MaskRay

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

4 years ago[ARM] MVE vector reduce add tests. NFC
David Green [Tue, 11 Feb 2020 12:17:03 +0000 (12:17 +0000)]
[ARM] MVE vector reduce add tests. NFC

4 years ago[llvm-objcopy] Fix pipeline syntax
Kadir Cetinkaya [Wed, 12 Feb 2020 10:34:40 +0000 (11:34 +0100)]
[llvm-objcopy] Fix pipeline syntax

4 years ago[lldb] Pass a valid SourceLocation to Sema::RequireCompleteType in ASTResultSynthesizer
Raphael Isemann [Mon, 10 Feb 2020 07:13:09 +0000 (08:13 +0100)]
[lldb] Pass a valid SourceLocation to Sema::RequireCompleteType in ASTResultSynthesizer

Sema::RequireCompleteTypeImpl is supposed to have an assert that checks that the
SourceLocation that is passed in is always valid. It's currently commented out, but
as soon as this assert goes active, nearly every LLDB expression will start crashing as
we always pass in an invalid SourceLocation from the ASTResultSynthesizer.

This patch just passes in the valid SourceLocation of the expression (which is
the SourceLocation where the complete type is required) to prevent that from happening.

4 years ago[clang] Add -fignore-exceptions
jasonliu [Tue, 11 Feb 2020 09:52:56 +0000 (09:52 +0000)]
[clang] Add -fignore-exceptions

Summary:

This is trying to implement the functionality proposed in:
http://lists.llvm.org/pipermail/cfe-dev/2017-April/053417.html
An exception can throw, but no cleanup is going to happen.
A module compiled with exceptions on, can catch the exception throws
from module compiled with -fignore-exceptions.

The use cases for enabling this option are:
1. Performance analysis of EH instrumentation overhead
2. The ability to QA non EH functionality when EH functionality is not available.
3. User of EH enabled headers knows the calls won't throw in their program and
   wants the performance gain from ignoring EH construct.

The implementation tried to accomplish that by removing any landing pad code
 that might get generated.

Reviewed by: aaron.ballman

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

4 years agoRevert "[SCCP] Remove forcedconstant, go to overdefined instead"
Florian Hahn [Wed, 12 Feb 2020 09:41:19 +0000 (09:41 +0000)]
Revert "[SCCP] Remove forcedconstant, go to overdefined instead"

This causes a crash for the reproducer below

 enum { a };
 enum b { c, d };
 e;
 static _Bool g(struct f *h, enum b i) {
   i &&j();
   return a;
 }
 static k(char h, enum b i) {
   _Bool l = g(e, i);
   l;
 }
 m(h) {
   k(h, c);
   g(h, d);
 }

This reverts commit aadb635e04854220064b77cc10d0e6772f5492fd.

4 years ago[CodeGen] Fix the computation of the alignment of split stores.
Clement Courbet [Mon, 10 Feb 2020 10:27:53 +0000 (11:27 +0100)]
[CodeGen] Fix the computation of the alignment of split stores.

Summary:
Right now the alignment of the lower half of a store is computed as
align/2, which fails for unaligned stores (align = 1), and is overly
pessimitic for, e.g. a 8 byte store aligned to 4 bytes.
Fixes PR44851
Fixes PR44877

Reviewers: gchatelet, spatel, lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[NFC?][SCEV][LoopVectorize] Add datalayout to the X86/float-induction-x86.ll test
Roman Lebedev [Wed, 12 Feb 2020 09:27:38 +0000 (12:27 +0300)]
[NFC?][SCEV][LoopVectorize] Add datalayout to the X86/float-induction-x86.ll test

Summary:
Currently, `SCEVExpander::isHighCostExpansionHelper()` has the following logic:
```
  if (auto *UDivExpr = dyn_cast<SCEVUDivExpr>(S)) {
    // If the divisor is a power of two and the SCEV type fits in a native
    // integer (and the LHS not expensive), consider the division cheap
    // irrespective of whether it occurs in the user code since it can be
    // lowered into a right shift.
    if (auto *SC = dyn_cast<SCEVConstant>(UDivExpr->getRHS()))
      if (SC->getAPInt().isPowerOf2()) {
        if (isHighCostExpansionHelper(UDivExpr->getLHS(), L, At,
                                      BudgetRemaining, TTI, Processed))
          return true;
        const DataLayout &DL =
            L->getHeader()->getParent()->getParent()->getDataLayout();
        unsigned Width = cast<IntegerType>(UDivExpr->getType())->getBitWidth();
        return DL.isIllegalInteger(Width);
      }
```

Since this test does not have a datalayout specified,
`SCEVExpander::isHighCostExpansionHelper()` says that
`[[TMP2:%.*]] = lshr exact i64 [[TMP1]], 5` is high-cost, and didn't perform it.

But future patches will change that logic to solely rely on cost-model,
without any such datalayout checks, so i think it is best to show
that that change is ephemeral, and can already happen without costmodel changes.

Reviewers: reames, fhahn, sanjoy, craig.topper, RKSimon

Reviewed By: RKSimon

Subscribers: javed.absar, llvm-commits

Tags: #llvm

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

4 years ago[DebugInfo] Enable the debug entry values feature by default
Djordje Todorovic [Mon, 10 Feb 2020 10:06:44 +0000 (11:06 +0100)]
[DebugInfo] Enable the debug entry values feature by default

This patch enables the debug entry values feature.

  - Remove the (CC1) experimental -femit-debug-entry-values option
  - Enable it for x86, arm and aarch64 targets
  - Resolve the test failures
  - Leave the llc experimental option for targets that do not
    support the CallSiteInfo yet

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

4 years agoRemove static registration for dialects, and the "alwayslink" hack for passes
Mehdi Amini [Wed, 12 Feb 2020 09:03:40 +0000 (09:03 +0000)]
Remove static registration for dialects, and the "alwayslink" hack for passes

In the previous state, we were relying on forcing the linker to include
all libraries in the final binary and the global initializer to self-register
every piece of the system. This change help moving away from this model, and
allow users to compose pieces more freely. The current change is only "fixing"
the dialect registration and avoiding relying on "whole link" for the passes.
The translation is still relying on the global registry, and some refactoring
is needed to make this all more convenient.

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

4 years ago[CodeGenPrepare] Add more store splitting tests for PR44877.
Clement Courbet [Wed, 12 Feb 2020 08:05:27 +0000 (09:05 +0100)]
[CodeGenPrepare] Add more store splitting tests for PR44877.

4 years ago[lldb][NFC] Remove GetConstTypeName and GetConstQualifiedTypeName from CompilerType
Raphael Isemann [Wed, 12 Feb 2020 08:35:19 +0000 (09:35 +0100)]
[lldb][NFC] Remove GetConstTypeName and GetConstQualifiedTypeName from CompilerType

Beside these two functions just being wrappers around GetTypeName they are also
just a leftover from migrating the CompilerType interface to ConstString.

4 years ago[lldb][NFC] Move common_completions mapping out of CommandCompletions header.
Raphael Isemann [Wed, 12 Feb 2020 08:22:59 +0000 (09:22 +0100)]
[lldb][NFC] Move common_completions mapping out of CommandCompletions header.

4 years ago[mlir] Revise naming of MLIROptMain and MLIRMlirOptLib
Marius Brehler [Wed, 12 Feb 2020 08:41:40 +0000 (09:41 +0100)]
[mlir] Revise naming of MLIROptMain and MLIRMlirOptLib

* Rename CMake target MLIROptMain to MLIROptLib:
   The target provides the main library
* Rename CMake target MLIRMlirOptLib to MLIRMlirOptMain:
   The target provides the main() entry function

At the moment, the Bazel configuration of TenorFlow maps the target
MlirOptLib to "lib/Support/MlirOptMain.cpp" and MlirOptMain to
"tools/mlir-opt/mlir-opt.cpp". This is the other way around in the CMake
configuration. As discussed in the context of the pull request
https://github.com/tensorflow/tensorflow/pull/36301, it seems useful to
revise the naming in the MLIR repo.

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

4 years ago[APFloat] Fix FP remainder operation
Ehud Katz [Wed, 12 Feb 2020 08:42:55 +0000 (10:42 +0200)]
[APFloat] Fix FP remainder operation

Reimplement IEEEFloat::remainder() function.

Fix PR3359.

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