platform/upstream/llvm.git
4 years agoRevert "[RISCV] Support Constant Pools in Load/Store Peephole"
Sam Elliott [Mon, 11 May 2020 17:13:41 +0000 (18:13 +0100)]
Revert "[RISCV] Support Constant Pools in Load/Store Peephole"

This reverts commit fe69dfebcfa007e23bf528fff8b96ac63e593e34, due to
a slight change in the API.

4 years ago[PowerPC][NFC] Convert an if/else to a conditional.
Sean Fertile [Mon, 11 May 2020 17:03:45 +0000 (13:03 -0400)]
[PowerPC][NFC] Convert an if/else to a conditional.

Change an if else to use a conditional which is shorter. Also name the
conditonal value to make the code clearer.

4 years ago[WebAssembly] Add wasm-specific vector shuffle builtin and intrinsic
Thomas Lively [Mon, 11 May 2020 16:55:43 +0000 (09:55 -0700)]
[WebAssembly] Add wasm-specific vector shuffle builtin and intrinsic

Summary:

Although using `__builtin_shufflevector` and the `shufflevector`
instruction works fine, they are not opaque to the optimizer. As a
result, DAGCombine can potentially reduce the number of shuffles and
change the shuffle masks. This is unexpected behavior for users of the
WebAssembly SIMD intrinsics who have crafted their shuffles to
optimize the code generated by engines. This patch solves the problem
by adding a new shuffle intrinsic that is opaque to the optimizers in
line with the decision of the WebAssembly SIMD contributors at
https://github.com/WebAssembly/simd/issues/196#issuecomment-622494748. In
the future we may implement custom DAG combines to properly optimize
shuffles and replace this solution.

Reviewers: aheejin, dschuff

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

Tags: #clang, #llvm

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

4 years ago[RISCV] Support Constant Pools in Load/Store Peephole
Sam Elliott [Mon, 11 May 2020 16:58:33 +0000 (17:58 +0100)]
[RISCV] Support Constant Pools in Load/Store Peephole

Summary:
RISC-V uses a post-select peephole pass to optimise
`(load/store (ADDI $reg, %lo(addr)), 0)` into `(load/store $reg, %lo(addr))`.
This peephole wasn't firing for accesses to constant pools, which is how we
materialise most floating point constants.

This adds support for the constantpool case, which improves code generation for
lots of small FP loading examples. I have not added any tests because this
structure is well-covered by the `fp-imm.ll` testcases, as well as almost
all other uses of floating point constants in the RISC-V backend tests.

Reviewed By: luismarques, asb

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

4 years agoProperly add out-of-module functions to the import list
Hongtao Yu [Mon, 11 May 2020 16:38:29 +0000 (09:38 -0700)]
Properly add out-of-module functions to the import list

This patch addresses two issues related to adding inline functions to the import list while recursively going through the profiling data.
1. For callsite samples, only add an inlined function to the import list if it's from outside of the module (i.e. only has a declaration inside the module).
2. For body samples, add each target function to the import list if it's from outside of the module (i.e. only has a declaration inside the module). Previously we were using getSubProgram() to check whether it has dbg info, which is inaccurate. This fix properly add imports and could improve the quality of the pass.

Added a few changes to the test to catch these cases.

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

4 years ago[lldb/test] Fix for flakiness in TestNSDictionarySynthetic
Vedant Kumar [Wed, 6 May 2020 23:08:19 +0000 (16:08 -0700)]
[lldb/test] Fix for flakiness in TestNSDictionarySynthetic

Summary:
TestNSDictionarySynthetic sets up an NSURL which does not initialize its
_baseURL member. When the test runs and we print out the NSURL, we print
out some garbage memory pointed-to by the _baseURL member, like:

```
_baseURL = 0x0800010020004029 @"d��qX"
```

and this can cause a python unicode decoding error like:

```
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa0 in position
10309: invalid start byte
```

There's a discrepancy here because lldb's StringPrinter facility tries
to only print out "printable" sequences (see: isprint32()), whereas python
rejects the StringPrinter output as invalid utf8. For the specific error
seen above, lldb's `isprint32(0xa0) = true`, even though 0xa0 is not
really "printable" in the usual sense.

The problem is that lldb and python disagree on what exactly is
"printable". Both have dismayingly hand-rolled utf8 validation code
(c.f. _Py_DecodeUTF8Ex), and I can't really tell which one is more
correct.

I tried replacing lldb's isprint32() with a call to libc's iswprint():
this satisfied python, but broke emoji printing :|.

Now, I believe that lldb (and python too) ought to just call into some
battle-tested utf library, and that we shouldn't aim for compatibility
with python's strict unicode decoding mode until then.

FWIW I ran this test under an ASanified lldb hundreds of times but
didn't turn up any other issues.

rdar://62941711

Reviewers: JDevlieghere, jingham, shafik

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[compile-rt] Reduce #ifdef noise for ptrauth
Julian Lettner [Thu, 7 May 2020 02:05:31 +0000 (19:05 -0700)]
[compile-rt] Reduce #ifdef noise for ptrauth

Create a sanitizer_ptrauth.h header that #includes <ptrauth> when
available and defines just the required macros as "no ops" otherwise.
This should avoid the need for excessive #ifdef'ing.

Follow-up to and discussed in: https://reviews.llvm.org/D79132

Reviewed By: delcypher

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

4 years ago[gn build] Port bf95cf4a681
LLVM GN Syncbot [Mon, 11 May 2020 16:35:33 +0000 (16:35 +0000)]
[gn build] Port bf95cf4a681

4 years ago[x86][seses] Introduce SESES pass for LVI
Zola Bridges [Mon, 11 May 2020 16:33:55 +0000 (09:33 -0700)]
[x86][seses] Introduce SESES pass for LVI

This is an implementation of Speculative Execution Side Effect
Suppression which is intended as a last resort mitigation against Load
Value Injection, LVI, a newly disclosed speculative execution side
channel vulnerability.

One pager:
https://software.intel.com/security-software-guidance/software-guidance/load-value-injection

Deep dive:
https://software.intel.com/security-software-guidance/insights/deep-dive-load-value-injection

The mitigation consists of a compiler pass that inserts an LFENCE before
each memory read instruction, memory write instruction, and the first
branch instruction in a group of terminators at the end of a basic
block. The goal is to prevent speculative execution, potentially based
on misspeculated conditions and/or containing secret data, from leaking
that data via side channels embedded in such instructions.

This is something of a last-resort mitigation: it is expected to have
extreme performance implications and it may not be a complete mitigation
due to trying to enumerate side channels.

In addition to the full version of the mitigation, this patch
implements three flags to turn off part of the mitigation. These flags
are disabled by default. The flags are not intended to result in a
secure variant of the mitigation. The flags are intended to be used by
users who would like to experiment with improving the performance of
the mitigation. I ran benchmarks with each of these flags enabled in
order to find if there was any room for further optimization of LFENCE
placement with respect to LVI.

Performance Testing Results

When applying this mitigation to BoringSSL, we see the following
results. These are a summary/aggregation of the performance changes when
this mitigation is applied versus when no mitigation is applied.

Fully Mitigated vs Baseline
Geometric mean
0.071 (Note: This can be read as the ops/s of the mitigated
program was 7.1% of the ops/s of the unmitigated program.)
Minimum
0.041
Quartile 1
0.060
Median
0.063
Quartile 3
0.077
Maximum
0.230

Reviewed By: george.burgess.iv

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

4 years ago[mlir] Simplify and better document std.view semantics
Nicolas Vasilache [Mon, 11 May 2020 16:09:18 +0000 (12:09 -0400)]
[mlir] Simplify and better document std.view semantics

This [discussion](https://llvm.discourse.group/t/viewop-isnt-expressive-enough/991/2) raised some concerns with ViewOp.

In particular, the handling of offsets is incorrect and does not match the op description.
Note that with an elemental type change, offsets cannot be part of the type in general because sizeof(srcType) != sizeof(dstType).

Howerver, offset is a poorly chosen term for this purpose and is renamed to byte_shift.

Additionally, for all intended purposes, trying to support non-identity layouts for this op does not bring expressive power but rather increases code complexity.

This revision simplifies the existing semantics and implementation.
This simplification effort is voluntarily restrictive and acts as a stepping stone towards supporting richer semantics: treat the non-common cases as YAGNI for now and reevaluate based on concrete use cases once a round of simplification occurred.

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

4 years ago[llvm][utils] Remove git-svn folder + scripts
Zola Bridges [Mon, 4 May 2020 18:51:16 +0000 (11:51 -0700)]
[llvm][utils] Remove git-svn folder + scripts

Summary:
These tools are no longer useful since we've migrated off of SVN, so
this patch deletes them.

Link: http://lists.llvm.org/pipermail/llvm-dev/2020-May/141386.html
Unless there is opposition in the RFC thread, I'll submit the patch on
May 10, 2020.

I searched through the repo to confirm there were no mentions of the scripts
in other scripts or documentation.

Reviewed By: echristo, tstellar, MaskRay

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

4 years agoAdd vendor identity check for Hygon Dhyana processor in Scudo
Kostya Kortchinsky [Mon, 11 May 2020 16:16:54 +0000 (09:16 -0700)]
Add vendor identity check for Hygon Dhyana processor in Scudo

Summary:
The Hygon Dhyana processor supports hardware CRC32.

Related link:
https://reviews.llvm.org/D78874

Result of "make check":
Testing Time: 1364.04s
  Unsupported Tests:   317
  Expected Passes  : 36802
  Expected Failures:   161
[100%] Built target check-llvm
[100%] Built target check

Reviewers: cryptoad

Reviewed By: cryptoad

Subscribers: craig.topper, cryptoad, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

4 years ago[gn build] Port 48fa355ed4b
LLVM GN Syncbot [Mon, 11 May 2020 16:11:59 +0000 (16:11 +0000)]
[gn build] Port 48fa355ed4b

4 years ago[llvm][NFC] Move inlining decision-related APIs in InliningAdvisor.
Mircea Trofin [Fri, 8 May 2020 03:35:08 +0000 (20:35 -0700)]
[llvm][NFC] Move inlining decision-related APIs in InliningAdvisor.

Summary: Factoring out in preparation to https://reviews.llvm.org/D79042

Reviewers: dblaikie, davidxl

Subscribers: mgorny, eraman, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb] Speculative fix for the entry values test on arm64
Pavel Labath [Mon, 11 May 2020 15:51:46 +0000 (17:51 +0200)]
[lldb] Speculative fix for the entry values test on arm64

The bot fails with a message which seems to indicate a problem in option
parsing. Avoid grouping the options to see if that helps.

4 years ago[Attributor] Fix for a crash on RAUW when rewriting function signature
Sergey Dmitriev [Mon, 11 May 2020 15:05:51 +0000 (08:05 -0700)]
[Attributor] Fix for a crash on RAUW when rewriting function signature

Reviewers: jdoerfert, sstefan1, uenoku

Reviewed By: uenoku

Subscribers: hiraditya, uenoku, llvm-commits

Tags: #llvm

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

4 years ago[PowerPC] Use PredictableSelectIsExpensive to enable select to branch in CGP
Kang Zhang [Mon, 11 May 2020 15:02:09 +0000 (15:02 +0000)]
[PowerPC] Use PredictableSelectIsExpensive to enable select to branch in CGP

Summary:
This patch will set the variable PredictableSelectIsExpensive to do the
select to if based on BranchProbability in CodeGenPrepare.

When the BranchProbability more than MinPercentageForPredictableBranch,
PPC will convert SELECT to branch.

Reviewed By: nemanjai

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

4 years ago[Clang] Fix the incorrect return type of atomic_is_lock_free
Kamlesh Kumar [Mon, 11 May 2020 14:47:42 +0000 (10:47 -0400)]
[Clang] Fix the incorrect return type of atomic_is_lock_free

Fixing the return type of atomic_is_lock_free as per
https://en.cppreference.com/w/c/atomic/atomic_is_lock_free

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

4 years ago[mlir][Linalg] NFC - Refactor and simplify Promotion
Nicolas Vasilache [Mon, 11 May 2020 14:39:16 +0000 (10:39 -0400)]
[mlir][Linalg] NFC - Refactor and simplify Promotion

Summary: This revision introduces LinalgPromotionOptions to more easily control the application of promotion patterns. It also simplifies the different entry points into Promotion in preparation for some behavior change in subsequent revisions.

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

4 years agoRevert "[DAGCombine] Remove the getNegatibleCost to avoid the out of sync with getNeg...
Sam McCall [Mon, 11 May 2020 14:44:01 +0000 (16:44 +0200)]
Revert "[DAGCombine] Remove the getNegatibleCost to avoid the out of sync with getNegatedExpression"

This reverts commit 3c44c441db0f8d7e210806b5b221cd9ed66f2d7b.

Causes infloops on some inputs, see https://reviews.llvm.org/D77319 for repro

4 years ago[x86] add test for funnel shift in loop with cross-block splat variable; NFC
Sanjay Patel [Mon, 11 May 2020 14:39:24 +0000 (10:39 -0400)]
[x86] add test for funnel shift in loop with cross-block splat variable; NFC

4 years ago[lldb/test] Make "inline" tests handle multiple statements at the same location
Pavel Labath [Thu, 7 May 2020 11:06:02 +0000 (13:06 +0200)]
[lldb/test] Make "inline" tests handle multiple statements at the same location

Summary:
The test machinery translates each continuous block of "//%" comments
into a single breakpoint. If there's no code between the blocks the
breakpoints will end up at the same location in the program. When the
process stops at a breakpoint lldb correctly reports all breakpoint IDs,
but the test machinery only looks at the first one. This results in a
very dangerous situation as it means some checks can be silently
stopped.

This patch fixes that by making the test machinery iterate through all
breakpoints at a given location and execute all commands.

Reviewers: vsk, JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[lldb] Revive TestBasicEntryValuesX86_64
Pavel Labath [Wed, 6 May 2020 14:06:42 +0000 (16:06 +0200)]
[lldb] Revive TestBasicEntryValuesX86_64

Summary:
This function rewrites the test to be (hopefully) less susceptible to
codegen changes and re-enables it.

The most interesting changes are:
- use an __attribute__((optnone)) function instead of a volatile asm to
  "use" a value. This isn't strictly necessary, but it makes the
  function simpler while achieving the same effect.
- use a call to a function with the exact same signature instead of a
  volatile asm to "destroy" arguments. This makes the independent of the
  ABI, and (together with avoiding the usage of the arguments after the
  call) ensures that the compiler has no reason to move the argument
  from its initial register (previously we needed to guess where will
  the compiler store the arguments).

Reviewers: vsk, djtodoro, dblaikie

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[analyzer] SATestBuild.py: Allow comments in run_static_analyzer.cmd.
Artem Dergachev [Mon, 11 May 2020 14:24:09 +0000 (17:24 +0300)]
[analyzer] SATestBuild.py: Allow comments in run_static_analyzer.cmd.

Because those can get really weird sometimes.

4 years ago[mlir][rocdl] Add xdlops intrinsics to rocdl dialect
rtayl [Fri, 8 May 2020 18:20:47 +0000 (14:20 -0400)]
[mlir][rocdl] Add xdlops intrinsics to rocdl dialect

Summary: This adds xdlops (mfma) to the rocdl dialect and also tests the translation to llvm ir.

Reviewers: ftynse

Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, llvm-commits

Tags: #llvm #mlir

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

4 years ago[lldb] Add missing nullptr checks to AppleObjCRuntime::GetBacktraceThreadFromException
Raphael Isemann [Mon, 11 May 2020 14:02:17 +0000 (16:02 +0200)]
[lldb] Add missing nullptr checks to AppleObjCRuntime::GetBacktraceThreadFromException

Summary:
We got a few crash reports where LLDB crashes while derefencing the `frames_value` shared_ptr in the AppleObjCRuntime::GetBacktraceThreadFromException. `GetChildMemberWithName` returns a nullptr when an error occurs, so this seems to be just a missing nullptr check.

This patch adds that nullptr check and the other ones in the similar code directly below.

Fixes rdar://62174039

Reviewers: jingham, kubamracek

Reviewed By: jingham

Subscribers: abidh, JDevlieghere

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

4 years agoTab completion for breakpoint write and breakpoint name add/delete
Gongyu Deng [Mon, 11 May 2020 13:54:13 +0000 (15:54 +0200)]
Tab completion for breakpoint write and breakpoint name add/delete

Summary: Apply the common completion created in [[ https://reviews.llvm.org/D75418 | Revision D75418 ]] to the commands  `breakpoint write` and `breakpoint name add/delete`.

Reviewers: teemperor, JDevlieghere

Reviewed By: teemperor

Tags: #lldb

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

4 years ago[mlir] More support for detached regions in affine symbol checkers
Alex Zinenko [Mon, 11 May 2020 13:26:11 +0000 (15:26 +0200)]
[mlir] More support for detached regions in affine symbol checkers

Add documentation to `isToLevelValue` explaining its behavior for
detached regions, and fix the overloaded version that accepts `Region`.

4 years ago[ELF][ARM] Support /DISCARD/ of subset of .ARM.exidx sections
Peter Smith [Fri, 8 May 2020 12:19:12 +0000 (13:19 +0100)]
[ELF][ARM] Support /DISCARD/ of subset of .ARM.exidx sections

Both the .ARM.exidx and .eh_frame sections have a custom SyntheticSection
that acts as a container for the InputSections. The InputSections are added
to the SyntheticSection prior to /DISCARD/ which limits the affect a
/DISCARD/ can have to the whole SyntheticSection. In the majority of cases
this is sufficient as it is not common to discard subsets of the
InputSections. The Linux kernel has one of these scripts which has something
like:
/DISCARD/ : { *(.ARM.exidx.exit.text) *(.ARM.extab.exit.text) ... }
The .ARM.exidx.exit.text are not discarded because the InputSection has been
transferred to the Synthetic Section. The *(.ARM.extab.exit.text) sections
have not so they are discarded. When we come to write out the .ARM.exidx
sections the dangling references from .ARM.exidx.exit.text to
.ARM.extab.exit.text currently cause relocation out of range errors, but
could as easily cause a fatal error message if we check for dangling
references at relocation time.

This patch attempts to respect the /DISCARD/ command by running it on the
.ARM.exidx InputSections stored in the SyntheticSection.

The .eh_frame is in theory affected by this problem, but I don't think that
there is a dangling reference problem that can happen with these sections.

Fixes remaining part of pr44824

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

4 years agoComplete breakpoint enable/disable/delete/modify with a list of breakpoint IDs
Gongyu Deng [Mon, 11 May 2020 13:21:37 +0000 (15:21 +0200)]
Complete breakpoint enable/disable/delete/modify with a list of breakpoint IDs

Summary:
1. A new common completion `CommandCompletions::Breakpoints` to provide a list of the breakpoints of the current context;
2. Apply the completion above to the commands breakpoint enable/disable/delete/modify;
3. Unit test.

Reviewers: teemperor, JDevlieghere

Reviewed By: teemperor

Tags: #lldb

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

4 years ago[mlir] NFC: Rename LoopOps dialect to SCF (Structured Control Flow)
Alex Zinenko [Mon, 11 May 2020 13:00:48 +0000 (15:00 +0200)]
[mlir] NFC: Rename LoopOps dialect to SCF (Structured Control Flow)

This dialect contains various structured control flow operaitons, not only
loops, reflect this in the name. Drop the Ops suffix for consistency with other
dialects.

Note that this only moves the files and changes the C++ namespace from 'loop'
to 'scf'. The visible IR prefix remains the same and will be updated
separately. The conversions will also be updated separately.

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

4 years ago[clangd] Fix remote index build for macOS with Homebrew-installed gRPC and Protobuf
Kirill Bobyrev [Mon, 11 May 2020 10:27:49 +0000 (12:27 +0200)]
[clangd] Fix remote index build for macOS with Homebrew-installed gRPC and Protobuf

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, llvm-commits

Tags: #llvm

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

4 years ago[AssumeBundles] fix crashes
Tyker [Mon, 11 May 2020 09:50:35 +0000 (11:50 +0200)]
[AssumeBundles] fix crashes

Summary:
this patch fixe crash/asserts found in the test-suite.
the AssumeptionCache cannot be assumed to have all assumes contrary to what i tought.
prevent generation of information for terminators, because this can create broken IR in transfromation where we insert the new terminator before removing the old one.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[NFC][DwarfDebug] Add test for variables with a single location which
OCHyams [Thu, 7 May 2020 11:41:20 +0000 (12:41 +0100)]
[NFC][DwarfDebug] Add test for variables with a single location which

don't span their entire scope.

The previous commit (6d1c40c171e) is an older version of the test.

Reviewed By: aprantl, vsk

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

4 years ago[NFC][DwarfDebug] Add test for variables with a single location which
OCHyams [Thu, 7 May 2020 11:41:20 +0000 (12:41 +0100)]
[NFC][DwarfDebug] Add test for variables with a single location which

don't span their entire scope.

The previous commit (6d1c40c171e) is an older version of the test.

Reviewed By: aprantl, vsk

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

4 years ago[NFC][DwarfDebug] Add test for variables with a single location which
OCHyams [Mon, 4 May 2020 12:28:07 +0000 (13:28 +0100)]
[NFC][DwarfDebug] Add test for variables with a single location which

don't span their entire scope.

Reviewed By: aprantl, vsk

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

4 years ago[SveEmitter] Add builtins for svmovlb and svmovlt
Sander de Smalen [Mon, 11 May 2020 07:52:02 +0000 (08:52 +0100)]
[SveEmitter] Add builtins for svmovlb and svmovlt

These builtins are expanded in CGBuiltin to use intrinsics
for (signed/unsigned) shift left long top/bottom.

Reviewers: efriedma, SjoerdMeijer

Reviewed By: efriedma

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

4 years ago[clangd] Make version in PublishDiagnosticsParams optional
Kadir Cetinkaya [Sun, 10 May 2020 21:29:27 +0000 (23:29 +0200)]
[clangd] Make version in PublishDiagnosticsParams optional

Summary: We were serializing it no matter what, which was against the spec

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[mlir][StandardToLLVM] Add support for lowering FPToSIOp to LLVM.
Hanhan Wang [Mon, 11 May 2020 08:29:08 +0000 (01:29 -0700)]
[mlir][StandardToLLVM] Add support for lowering FPToSIOp to LLVM.

Summary: Depends On D79374

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

4 years ago[mlir][StandardToSPIRV] Add support for lowering FPToSIOp to SPIR-V.
Hanhan Wang [Mon, 11 May 2020 08:26:57 +0000 (01:26 -0700)]
[mlir][StandardToSPIRV] Add support for lowering FPToSIOp to SPIR-V.

Summary: Depends On D79373

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

4 years ago[mlir] Add FPToSIOp to Standard dialect.
Hanhan Wang [Mon, 11 May 2020 08:25:45 +0000 (01:25 -0700)]
[mlir] Add FPToSIOp to Standard dialect.

Summary:
Cast from a value interpreted as floating-point to the corresponding signed
integer value. Similar to an element-wise `static_cast` in C++, performs an
element-wise conversion operation.

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

4 years ago[NFC][DwarfDebug] Avoid default capturing when using lambdas
Djordje Todorovic [Mon, 11 May 2020 07:30:36 +0000 (09:30 +0200)]
[NFC][DwarfDebug] Avoid default capturing when using lambdas

It is bad practice to capture by default (via [&] in this case) when
using lambdas, so we should avoid that as much as possible.

This patch fixes that in the getForwardingRegsDefinedByMI
from DwarfDebug module.

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

4 years agoAdd a missing test file for recovery expressions.
Haojian Wu [Mon, 11 May 2020 07:23:32 +0000 (09:23 +0200)]
Add a missing test file for recovery expressions.

The test was missed in 8222107aa9249aada81334c922a2d284042242.

4 years agoFix -Wunused compiler warning.
Haojian Wu [Mon, 11 May 2020 07:19:42 +0000 (09:19 +0200)]
Fix -Wunused compiler warning.

4 years ago[NFC][DwarfDebug] Prefer explicit to auto type deduction
Djordje Todorovic [Fri, 8 May 2020 10:04:45 +0000 (12:04 +0200)]
[NFC][DwarfDebug] Prefer explicit to auto type deduction

We should use explicit type instead of auto type deduction when
the type is so obvious. In addition, we remove ambiguity, since auto
type deduction sometimes is not that intuitive, so that could lead
us to some unwanted behavior.

This patch fixes that in the collectCallSiteParameters() from
DwarfDebug module.

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

4 years ago[AST] Preserve the type in RecoveryExprs for broken function calls.
Haojian Wu [Fri, 8 May 2020 14:13:17 +0000 (16:13 +0200)]
[AST] Preserve the type in RecoveryExprs for broken function calls.

RecoveryExprs are modeled as dependent type to prevent bogus diagnostics
and crashes in clang.

This patch allows to preseve the type for broken calls when the
RecoveryEprs have a known type, e.g. a broken non-overloaded call, a
overloaded call when the all candidates have the same return type, so
that more features (code completion still work on "take2args(x).^") still
work.

However, adding the type is risky, which may result in more clang code being
affected leading to new crashes and hurt diagnostic, and it requires large
effort to minimize the affect (update all sites in clang to handle errorDepend
case), so we add a new flag (off by default) to allow us to develop/test
them incrementally.

This patch also has some trivial fixes to suppress diagnostics (to prevent regressions).

Tested:

all existing tests are passed (when both "-frecovery-ast", "-frecovery-ast-type" flags are flipped on);

Reviewed By: sammccall

Subscribers: rsmith, arphaman, cfe-commits

Tags: #clang

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

4 years ago[LLDB] Fix broken testsuite due to Xfail decorators
Muhammad Omair Javaid [Mon, 11 May 2020 05:18:50 +0000 (10:18 +0500)]
[LLDB] Fix broken testsuite due to Xfail decorators

Following test cases need minor adjustment in order to accomodate xfail
decorator:
  lldb/test/Shell/SymbolFile/NativePDB/break-by-line.cpp
  lldb/test/Shell/SymbolFile/NativePDB/source-list.cpp

4 years agoRemove an unused Module param
Xun Li [Mon, 11 May 2020 04:50:32 +0000 (21:50 -0700)]
Remove an unused Module param

Summary:
In D65848 the function getFuncNameInModule was refactored to no longer use module.
This diff removes the parameter and rename the function name to avoid confusion.

Reviewers: wenlei, wmi, davidxl

Reviewed By: wenlei

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Object] Remove unused variable after D79560. NFC.
Xing GUO [Mon, 11 May 2020 05:02:39 +0000 (13:02 +0800)]
[Object] Remove unused variable after D79560. NFC.

4 years ago[gcov] Implement --stdout -t
Fangrui Song [Mon, 11 May 2020 00:16:01 +0000 (17:16 -0700)]
[gcov] Implement --stdout -t

gcov by default prints to a .gcov file. With --stdout, stdout is used.
Some summary information is omitted. There is no separator for multiple
source files.

4 years ago[Attributor] Merge the query set into AbstractAttribute
Johannes Doerfert [Fri, 17 Apr 2020 01:32:46 +0000 (20:32 -0500)]
[Attributor] Merge the query set into AbstractAttribute

The old QuerriedAAs contained two vectors, one for required one for
optional dependences (=queries). We now use a single vector and encode
the kind directly in the pointer.

This reduces memory consumption and makes the connection between
abstract attributes and their dependences clearer.

No functional change is intended, changes in the test are due to
different order in the query map. Neither the order before nor now is in
any way special.

---

Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):

Before:
```
calls to allocation functions: 543734 (329735/s)
temporary memory allocations: 105895 (64217/s)
peak heap memory consumption: 19.19MB
peak RSS (including heaptrack overhead): 102.26MB
total memory leaked: 269.10KB
```

After:
```
calls to allocation functions: 513292 (341511/s)
temporary memory allocations: 106028 (70544/s)
peak heap memory consumption: 13.35MB
peak RSS (including heaptrack overhead): 95.64MB
total memory leaked: 269.10KB
```

Difference:
```
calls to allocation functions: -30442 (208506/s)
temporary memory allocations: 133 (-910/s)
peak heap memory consumption: -5.84MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
```

---

Reviewed By: uenoku

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

4 years ago[DAGCombine] Remove the getNegatibleCost to avoid the out of sync with getNegatedExpr...
QingShan Zhang [Mon, 11 May 2020 02:41:10 +0000 (02:41 +0000)]
[DAGCombine] Remove the getNegatibleCost to avoid the out of sync with getNegatedExpression

We have the getNegatibleCost/getNegatedExpression to evaluate the cost and negate the expression.
However, during negating the expression, the cost might change as we are changing the DAG,
and then, hit the assertion if we negated the wrong expression as the cost is not trustful anymore.

This patch is target to remove the getNegatibleCost to avoid the out of sync with getNegatedExpression,
and check the cost during negating the expression. It also reduce the duplicated code between
getNegatibleCost and getNegatedExpression. And fix the crash for the test in D76638

Reviewed By: RKSimon, spatel

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

4 years ago[LLDB] Decorate tests failing on arm-linux buildbot
Muhammad Omair Javaid [Mon, 11 May 2020 02:01:39 +0000 (07:01 +0500)]
[LLDB] Decorate tests failing on arm-linux buildbot

Tests impacted by these decorators fail on arm-linux-gnueabihf.

These have been triaged and appropriate bugs have been filed.

4 years agoRemove XFAIL arm-linux decorator from passing tests
Muhammad Omair Javaid [Sun, 10 May 2020 23:44:57 +0000 (04:44 +0500)]
Remove XFAIL arm-linux decorator from passing tests

4 years agoXFAIL NativePDB tests on arm-linux
Muhammad Omair Javaid [Sun, 10 May 2020 23:40:23 +0000 (04:40 +0500)]
XFAIL NativePDB tests on arm-linux

NativePDB tests fail on arm-linux buildbot. clang-cl driver crashes with
-m32 option. Bug files http://llvm.org/pr45867

4 years ago[X86] Fix combineVectorCompareAndMaskUnaryOp regression after 0e8e731449d8fbfa6ba4523...
Fangrui Song [Mon, 11 May 2020 01:21:18 +0000 (18:21 -0700)]
[X86] Fix combineVectorCompareAndMaskUnaryOp regression after 0e8e731449d8fbfa6ba4523de928b4812ef9f100

4 years ago[examples] Fix the SpeculativeJIT and ThinLtoJIT examples for 41379f1ec46.
Lang Hames [Mon, 11 May 2020 00:33:48 +0000 (17:33 -0700)]
[examples] Fix the SpeculativeJIT and ThinLtoJIT examples for 41379f1ec46.

4 years agoRemove a comment that is no longer true after d03838343f2.
Nico Weber [Mon, 11 May 2020 00:15:29 +0000 (20:15 -0400)]
Remove a comment that is no longer true after d03838343f2.

4 years agoRemove a variable write that is not needed after d03838343f2.
Nico Weber [Mon, 11 May 2020 00:13:05 +0000 (20:13 -0400)]
Remove  a variable write that is not needed after d03838343f2.

4 years ago[Attributor][FIX] Carefully handle/ignore/forget `argmemonly`
Johannes Doerfert [Sat, 9 May 2020 17:48:29 +0000 (12:48 -0500)]
[Attributor][FIX] Carefully handle/ignore/forget `argmemonly`

When we have an existing `argmemonly` or `inaccessiblememorargmemonly`
we used to "know" that information. However, interprocedural constant
propagation can invalidate these attributes. We now ignore and remove
these attributes for internal functions (which may be affected by IP
constant propagation), if we are deriving new attributes for the
function.

4 years ago[Attributor] Use "simplify to constant" in genericValueTraversal
Johannes Doerfert [Sun, 10 May 2020 04:29:43 +0000 (23:29 -0500)]
[Attributor] Use "simplify to constant" in genericValueTraversal

As we replace values with constants interprocedurally, we also need to
do this "look-through" step during the generic value traversal or we
would derive properties from replaced values. While this is often not
problematic, it is when we use the "kind" of a value for reasoning,
e.g., accesses to arguments allow `argmemonly`.

4 years ago[Attributor] Ignore illegal accesses to `null`
Johannes Doerfert [Sun, 10 May 2020 21:53:07 +0000 (16:53 -0500)]
[Attributor] Ignore illegal accesses to `null`

When we categorize a pointer value we bailed at `null` before. If we
know `null` is not a valid memory location we can ignore it as there
won't be an access at all.

4 years ago[Attributor] Use existing helpers to determine IR facts
Johannes Doerfert [Sun, 10 May 2020 18:16:49 +0000 (13:16 -0500)]
[Attributor] Use existing helpers to determine IR facts

We now use getPointerDereferenceableBytes to determine `nonnull` and
`dereferenceable` facts from the IR. We also use getPointerAlignment in
AAAlign for the same reason. The latter can interfere with callbacks so
we do restrict it to non-function-pointers for now.

4 years ago[Attributor][NFC] Clang format Attributor*.cpp
Johannes Doerfert [Sat, 9 May 2020 17:49:39 +0000 (12:49 -0500)]
[Attributor][NFC] Clang format Attributor*.cpp

4 years ago[ORC] Share ownership of JITDylibs between ExecutionSession and
Lang Hames [Sun, 10 May 2020 18:34:04 +0000 (11:34 -0700)]
[ORC] Share ownership of JITDylibs between ExecutionSession and
MaterializationResponsibility.

MaterializationResponsibility objects provide a connection between a
materialization process (compiler, jit linker, etc.) and the JIT state held in
the ExecutionSession and JITDylib objects. Switching to shared ownership
extends the lifetime of JITDylibs to ensure they remain accessible until all
materializers targeting them have completed. This will allow (in a follow-up
patch) JITDylibs to be removed from the ExecutionSession and placed in a
pending-destruction state while they are kept alive to communicate errors
to/from any still-runnning materialization processes. The intent is to enable
JITDylibs to be safely removed even if they have running compiles targeting
them.

4 years ago[gcov] Default coverage version to '407*' and delete CC1 option -coverage-cfg-checksum
Fangrui Song [Sun, 10 May 2020 19:47:45 +0000 (12:47 -0700)]
[gcov] Default coverage version to '407*' and delete CC1 option -coverage-cfg-checksum

Defaulting to -Xclang -coverage-version='407*' makes .gcno/.gcda
compatible with gcov [4.7,8)

In addition, delete clang::CodeGenOptionsBase::CoverageExtraChecksum and GCOVOptions::UseCfgChecksum.
We can infer the information from the version.

With this change, .gcda files produced by `clang --coverage a.o` linked executable can be read by gcov 4.7~7.
We don't need other -Xclang -coverage* options.
There may be a mismatching version warning, though.

(Note, GCC r173147 "split checksum into cfg checksum and line checksum"
 made gcov 4.7 incompatible with previous versions.)

4 years ago[examples] Fix llvm.memset prototype in BrainF example.
Ricky Zhou [Sun, 10 May 2020 20:51:01 +0000 (16:51 -0400)]
[examples] Fix llvm.memset prototype in BrainF example.

Commit 1e68724d24ba38de7c7cdb2e1939d78c8b37cc0d removed the alignment
argument from the memset intrinsic. Update the BrainF example to match.

Reviewed By: jyknight
Differential Revision: https://reviews.llvm.org/D79601

4 years agoAMDGPU/GlobalISel: Remove -global-isel-abort=0 from tests
Matt Arsenault [Sun, 10 May 2020 19:27:40 +0000 (15:27 -0400)]
AMDGPU/GlobalISel: Remove -global-isel-abort=0 from tests

4 years agoFix clangd test that depended on a diagnostic removed in Clang.
Richard Smith [Sun, 10 May 2020 21:13:25 +0000 (14:13 -0700)]
Fix clangd test that depended on a diagnostic removed in Clang.

4 years agoEnforce the C++11 anonymous enum bitfields check even for
Richard Smith [Sun, 10 May 2020 20:58:42 +0000 (13:58 -0700)]
Enforce the C++11 anonymous enum bitfields check even for
Objective-C++11 and under MS extensions.

This matches the MSVC behavior, and means that Objective-C behaves as a
set of extensions to the base language, rather than replacing the base
language rule with a different one.

4 years agoFix typo in enum-base disambiguation.
Richard Smith [Sun, 10 May 2020 20:39:23 +0000 (13:39 -0700)]
Fix typo in enum-base disambiguation.

4 years ago[LLD] [COFF] Fix def file exporting of symbols containing periods
Martin Storsjö [Fri, 8 May 2020 08:01:09 +0000 (11:01 +0300)]
[LLD] [COFF] Fix def file exporting of symbols containing periods

This fixes an accidental breakage of exporting symbols using def
files, when the symbol name contains a period, since commit
0ca06f7950e5, mixing up a symbol name containing a period with
the case of exporting a symbol as a forward to another dll.

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

4 years agoProperly implement 'enum class' parsing.
Richard Smith [Sun, 10 May 2020 20:14:51 +0000 (13:14 -0700)]
Properly implement 'enum class' parsing.

The 'class' or 'struct' keyword is only permitted as part of either an
enum definition or a standalone opaque-enum-declaration, not as part of
an elaborated type specifier. We previously failed to diagnose this, and
generally didn't properly implement the restrictions on elaborated type
specifiers for enumeration types.

In passing, also fixed incorrect parsing for enum-bases, which we
previously parsed as a type-name, but are actually a type-specifier-seq.
This matters for cases like 'enum E : int *p;', which is valid as a
Microsoft extension.

Plus some minor parse diagnostic improvements.

Bumped the recently-added ExtWarn for 'enum E : int x;' to be
DefaultError; this is not an intentional extension, so producing an
error by default seems appropriate, but the warning flag to disable it
may still be useful for code written against old Clang. The same
treatment is given here to the diagnostic for 'enum class E x;', which
we similarly have incorrectly accepted for many years. These diagnostics
continue to be suppressed under -fms-extensions and when compiling
Objective-C code. We will need to decide separately whether Objective-C
should follow the C++ rules or the (older) MSVC rules.

4 years ago[gcov] Delete CC1 option -coverage-no-function-names-in-data
Fangrui Song [Sun, 10 May 2020 17:50:20 +0000 (10:50 -0700)]
[gcov] Delete CC1 option -coverage-no-function-names-in-data

rL144865 incorrectly wrote function names for GCOV_TAG_FUNCTION
(this might be part of the reasons the header says
"We emit files in a corrupt version of GCOV's "gcda" file format").

rL176173 and rL177475 realized the problem and introduced -coverage-no-function-names-in-data
to work around the issue. (However, the description is wrong.
libgcov never writes function names, even before GCC 4.2).

In reality, the linker command line has to look like:

clang --coverage -Xclang -coverage-version='407*' -Xclang -coverage-cfg-checksum -Xclang -coverage-no-function-names-in-data

Failing to pass -coverage-no-function-names-in-data can make gcov 4.7~7
either produce wrong results (for one gcov-4.9 program, I see "No executable lines")
or segfault (gcov-7).
(gcov-8 uses an incompatible format.)

This patch deletes -coverage-no-function-names-in-data and the related
function names support from libclang_rt.profile

4 years ago[X86] Add a few more shuffles to hasUndefRegUpdate.
Craig Topper [Sun, 10 May 2020 08:32:56 +0000 (01:32 -0700)]
[X86] Add a few more shuffles to hasUndefRegUpdate.

Mostly found by asserting on tests that have undef operands. I'm
sure this isn't an exhaustive list.

4 years ago[AssumeBundles] Remove non-determinisme from assume builder
Tyker [Sun, 10 May 2020 17:26:41 +0000 (19:26 +0200)]
[AssumeBundles] Remove non-determinisme from assume builder

Summary:
The assume builder was non-deterministic when working on unamed values.
this patch fixes this.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: hiraditya, mgrang, llvm-commits

Tags: #llvm

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

4 years ago[MCA][InstrBuilder] Correctly mark reserved resources in initializeUsedResources.
Andrea Di Biagio [Sun, 10 May 2020 17:55:58 +0000 (18:55 +0100)]
[MCA][InstrBuilder] Correctly mark reserved resources in initializeUsedResources.

This fixes a bug reported by Alex Renda on LLVMDev where mca did not correctly
mark a resource group as "reserved".
(See http://lists.llvm.org/pipermail/llvm-dev/2020-May/141485.html).

The issue was caused by a wrong check in function `initializeUsedResources`.
As a consequence of this, a resource group was left unreserved, and its field
`NumUnits` incorrectly reported an unrealistic number of consumed resource
units.

This patch fixes the issue with the handling of reserved resources in the
InstrBuilder class, and adds a simple test for it.  Ideally, as suggested by
Andy Trick, most of these problems will disappear if in the future we will
introduce a (optional) DelayCycles vector for SchedWriteRes.

4 years ago[gcov] Temporarily unsupport host-byteorder-big-endian
Fangrui Song [Sun, 10 May 2020 18:17:17 +0000 (11:17 -0700)]
[gcov] Temporarily unsupport host-byteorder-big-endian

4 years ago[compiler-rt][test] Add feature host-byteorder-big-endian
Fangrui Song [Sun, 10 May 2020 18:01:06 +0000 (11:01 -0700)]
[compiler-rt][test] Add feature host-byteorder-big-endian

This is needed to make 5a9b792d7251e19f69f96c9619cde49497c79a07 "[gcov] Temporarily unsupport host-byteorder-big-endian"
work.

4 years ago[gcov] Temporarily unsupport host-byteorder-big-endian
Fangrui Song [Sun, 10 May 2020 17:26:10 +0000 (10:26 -0700)]
[gcov] Temporarily unsupport host-byteorder-big-endian

llvm-cov gcov does not support host-byteorder-big-endian yet.

4 years ago[AssumeBundles] Prevent generation of some redundant assumes
Tyker [Sun, 10 May 2020 16:20:34 +0000 (18:20 +0200)]
[AssumeBundles] Prevent generation of some redundant assumes

Summary: with this patch the assume salvageKnowledge will not generate assume if all knowledge is already available in an assume with valid context. assume bulider can also in some cases update an existing assume with better information.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[gcov] Don't skip leading zeros when reading a string
Fangrui Song [Sun, 10 May 2020 17:12:26 +0000 (10:12 -0700)]
[gcov] Don't skip leading zeros when reading a string

Even a 2003 version of gcov_read_string does not have the behavior
described by rL204881. The wrong impression might come from
libclang_rt.profile (GCDAProfiling.c)'s corrupted output (since the
initial import rL144865). Note, the corrupted output crashes gcov.

4 years ago[gcov] Fix .gcda decoding and support GCC 8, 9 and 10
Fangrui Song [Sat, 9 May 2020 17:36:34 +0000 (10:36 -0700)]
[gcov] Fix .gcda decoding and support GCC 8, 9 and 10

GCDAProfiling.c unnecessarily writes function names to .gcda files.
GCC 4.2 gcc/libgcov.c (now renamed to libgcc/libgcov*) did not write function
names. gcov-7 (compatible) crashes on .gcda produced by libclang_rt.profile
rL176173 realized the problem and introduced a mode to remove function
names.

llvm-cov code apparently takes GCDAProfiling.c output format as truth
and tries to decode function names.  Additionally, llvm-cov tries to
decode tags in certain order which does not match libgcov emitted .gcda
files.

This patch fixes the .gcda decoder and makes it work with GCC 8 and 9
(10 is compatible with 9). Note, line statistics are broken and not
fixed by this patch.

Add test/tools/llvm-cov/gcov-{4.7,8,9}.c to test compatibility.

4 years ago[LAA] Move runtime-check generation to Transforms/Utils/loopUtils (NFC)
Florian Hahn [Sun, 10 May 2020 15:48:06 +0000 (16:48 +0100)]
[LAA] Move runtime-check generation to Transforms/Utils/loopUtils (NFC)

Currently LAA's uses of ScalarEvolutionExpander blocks moving the
expander from Analysis to Transforms. Conceptually the expander does not
fit into Analysis (it is only used for code generation) and
runtime-check generation also seems to be better suited as a
transformation utility.

Reviewers: Ayal, anemet

Reviewed By: Ayal

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

4 years agoCodeMetrics.cpp - remove unused includes. NFC.
Simon Pilgrim [Sun, 10 May 2020 15:59:39 +0000 (16:59 +0100)]
CodeMetrics.cpp - remove unused includes. NFC.

4 years agoLoopUtils.h - remove unused forward declarations. NFC.
Simon Pilgrim [Sun, 10 May 2020 15:58:34 +0000 (16:58 +0100)]
LoopUtils.h - remove unused forward declarations. NFC.

4 years agoLocal.h - remove unused forward declaration. NFC.
Simon Pilgrim [Sun, 10 May 2020 15:57:46 +0000 (16:57 +0100)]
Local.h - remove unused forward declaration. NFC.

4 years ago[InstCombine] canonicalize bitcast after insertelement into undef
Sanjay Patel [Sun, 10 May 2020 15:37:47 +0000 (11:37 -0400)]
[InstCombine] canonicalize bitcast after insertelement into undef

We have a transform in the opposite direction only for the x86 MMX type,
Other types are not handled either way before this patch.

The motivating case from PR45748:
https://bugs.llvm.org/show_bug.cgi?id=45748
...is the last test diff. In that example, we are triggering an existing
bitcast transform, so we reduce the number of casts, and that should give
us the ideal x86 codegen.

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

4 years ago[CodeGen] fix test to be (mostly) independent of LLVM optimizer; NFC
Sanjay Patel [Sun, 10 May 2020 15:25:37 +0000 (11:25 -0400)]
[CodeGen] fix test to be (mostly) independent of LLVM optimizer; NFC

This test would break with the proposed change to IR canonicalization
in D79171.

The test tried to do the right thing by only using -mem2reg with opt,
but it was using -O3 before that step, so the opt part was meaningless.

4 years ago[CodeGen] fix test to be (mostly) independent of LLVM optimizer; NFC
Sanjay Patel [Sun, 10 May 2020 15:19:43 +0000 (11:19 -0400)]
[CodeGen] fix test to be (mostly) independent of LLVM optimizer; NFC

This test would break with the proposed change to IR canonicalization
in D79171. The raw unoptimized IR from clang is massive, so I've
replaced -instcombine with -mem2reg to make it more manageable,
but still be unlikely to break with unrelated changed to optimization.

4 years ago[InstCombine] matchOrConcat - match BITREVERSE
Simon Pilgrim [Sun, 10 May 2020 15:00:13 +0000 (16:00 +0100)]
[InstCombine] matchOrConcat - match BITREVERSE

Fold or(zext(bitreverse(x)),shl(zext(bitreverse(y)),bw/2) -> bitreverse(or(zext(x),shl(zext(y),bw/2))

Practically this is the same as the BSWAP pattern so we might as well handle it.

4 years agoRecommit "[LAA] Remove one addRuntimeChecks function (NFC)."
Florian Hahn [Sun, 10 May 2020 14:04:49 +0000 (15:04 +0100)]
Recommit "[LAA] Remove one addRuntimeChecks function (NFC)."

The failing assertion has been fixed and the problematic test case has
been added.

This reverts the revert commit fc44617f28847417e55836193bbe8e9c3f09eca9.

4 years agoPassInstrumentation.h - reduce TypeName.h include to StringRef forward declaration...
Simon Pilgrim [Sun, 10 May 2020 13:22:02 +0000 (14:22 +0100)]
PassInstrumentation.h - reduce TypeName.h include to StringRef forward declaration. NFC.

4 years agoCoverageMapping.h - remove unused StringSet.h include. NFC.
Simon Pilgrim [Sun, 10 May 2020 13:19:54 +0000 (14:19 +0100)]
CoverageMapping.h - remove unused StringSet.h include. NFC.

4 years agoPassManager.h - remove unused raw_ostream.h include. NFC.
Simon Pilgrim [Sun, 10 May 2020 13:17:52 +0000 (14:17 +0100)]
PassManager.h - remove unused raw_ostream.h include. NFC.

4 years agoMangler.h - reduce GlobalValue.h include to forward declaration. NFC.
Simon Pilgrim [Sun, 10 May 2020 13:03:13 +0000 (14:03 +0100)]
Mangler.h - reduce GlobalValue.h include to forward declaration. NFC.

Exposes implicit dependency in ModuleSymbolTable.h - added missing Module forward declaration.

4 years agoLoopPass.h - remove unnecessary PMStack forward declaration. NFC.
Simon Pilgrim [Sun, 10 May 2020 13:01:26 +0000 (14:01 +0100)]
LoopPass.h - remove unnecessary PMStack forward declaration. NFC.

We have to include LegacyPassManagers.h where its defined.

4 years agoRevert "[LAA] Remove one addRuntimeChecks function (NFC)."
Florian Hahn [Sun, 10 May 2020 12:27:10 +0000 (13:27 +0100)]
Revert "[LAA] Remove one addRuntimeChecks function (NFC)."

This reverts commit c28114c8ffde705d7e16cd4c065fd23269661c81.

This causes some bots to fail:

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/30596/steps/build%20android%2Faarch64/logs/stdio

4 years ago[mlir] Affine dim and symbol checkers: support detached regions
Alex Zinenko [Sun, 10 May 2020 12:14:10 +0000 (14:14 +0200)]
[mlir] Affine dim and symbol checkers: support detached regions

Functions checking whether an SSA value is a valid dimension or symbol for
affine operations can be called on values defined in a detached region (a
region that is not yet attached to an operation), for example, during parsing
or operation construction. These functions will attempt to uncondtionally
dereference a pointer to the parent operation of a region, which may be null
(as fixed by the previous commit, uninitialized before that). Since one cannot
know to which operation a region will be attached, conservatively this
operation would not be a valid affine scope and act accordingly, instead of
crashing.

4 years ago[mlir] Initialize the Region::container field to nullptr by default
Alex Zinenko [Sun, 10 May 2020 12:14:04 +0000 (14:14 +0200)]
[mlir] Initialize the Region::container field to nullptr by default

Region has a default constructor that is called when a region is constructed
while an operation is being created, and therefore before the region can be
attached to this operation. The `container` field is uninitialized, which makes
it impossible to check programmatically if a Region is attached to an operation
or not, leading to sly memory errors when this field is read. Initialize it to
nullptr by default and thus make sure one can check if a region is attached to
an operation or not.