Commit Graph

392120 Commits

Author SHA1 Message Date
Dmitry Vyukov 2f6f24f010 tsan: re-enable mmap_stress.cpp test
The comment says it was flaky in 2016,
but it wasn't possible to debug it back then.
Re-enable the test at least on linux/x86_64.
It will either work, or at least we should
see failure output from lit today.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D104592
2021-06-24 09:48:34 +02:00
Dmitry Vyukov 1db68fcd8e tsan: fix mmap atomicity
Mmap interceptor is not atomic in the sense that it
exposes unmapped shadow for a brief period of time.
This breaks programs that mmap over another mmap
and access the region concurrently.
Don't unmap shadow in the mmap interceptor to fix this.
Just mapping new shadow on top should be enough to zero it.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D104593
2021-06-24 09:47:44 +02:00
Vitaly Buka 35e1dbd189 [scudo] Fix test on arch without MTE 2021-06-24 00:07:24 -07:00
Vitaly Buka 6fd963ab64 [scudo] Avoid ifdef in test 2021-06-23 23:58:09 -07:00
Vitaly Buka 99ec78c0fe [scudo] Fix use of ScopedDisableMemoryTagChecks in test 2021-06-23 23:57:17 -07:00
Walter Erquinigo f0d0612476 [NFC][trace] remove dead function
The Trace::GetCursorPosition function was never really implemented well and it's being replaced by a more correct TraceCursor object.
2021-06-23 23:18:53 -07:00
Vitaly Buka 533abb7ecf [scudo] Enabled MTE before the first allocator
Reviewed By: pcc

Differential Revision: https://reviews.llvm.org/D103726
2021-06-23 23:01:26 -07:00
Walter Erquinigo 2aa1dd1c66 [trace] Add a TraceCursor class
As a follow up of D103588, I'm reinitiating the discussion with a new proposal for traversing instructions in a trace which uses the feedback gotten in that diff.

See the embedded documentation in TraceCursor for more information. The idea is to offer an OOP way to traverse instructions exposing a minimal interface that makes no assumptions on:

- the number of instructions in the trace (i.e. having indices for instructions might be impractical for gigantic intel-pt traces, as it would require to decode the entire trace). This renders the use of indices to point to instructions impractical. Traces are big and expensive, and the consumer should try to do look linear lookups (forwards and/or backwards) and avoid random accesses (the API could be extended though, but for now I want to dicard that funcionality and leave the API extensible if needed).
- the way the instructions are represented internally by each Trace plug-in. They could be mmap'ed from a file, exist in plain vector or generated on the fly as the user requests the data.
- the actual data structure used internally for each plug-in. Ideas like having a struct TraceInstruction have been discarded because that would make the plug-in follow a certain data type, which might be costly. Instead, the user can ask the cursor for each independent property of the instruction it's pointing at.

The way to get a cursor is to ask Trace.h for the end or being cursor or a thread's trace.

There are some benefits of this approach:
- there's little cost to create a cursor, and this allows for lazily decoding a trace as the user requests data.
- each trace plug-in could decide how to cache the instructions it generates. For example, if a trace is small, it might decide to keep everything in memory, or if the trace is massive, it might decide to keep around the last thousands of instructions to speed up local searches.
- a cursor can outlive a stop point, which makes trace comparison for live processes feasible. An application of this is to compare profiling data of two runs of the same function, which should be doable with intel pt.

Differential Revision: https://reviews.llvm.org/D104422
2021-06-23 22:28:01 -07:00
Greg McGary 8a8558ae27 [lld-macho] add tests for ICF, plus cleanups
Add tests for pending TODOs, plus some global cleanups:
* No fold: func has personality/LSDA
* Fold: reference to absolute symbol with different name but identical value
* No fold: reloc references to absolute symbols with different values
* No fold: N_ALT_ENTRY symbols

Differential Revision: https://reviews.llvm.org/D104721
2021-06-23 20:44:25 -07:00
Carl Ritson 98f48723f2 [AMDGPU] Add 224-bit vector types and link 192-bit types to MVTs
Add SReg_224, VReg_224, AReg_224, etc.
Link 224-bit types with v7i32/v7f32.
Link existing 192-bit types to newly added v3i64/v3f64/v6i32/v6f32.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D104622
2021-06-24 12:41:22 +09:00
Carl Ritson 6b0f98d442 [ValueTypes] Define MVTs for v3i64/v3f64 to complement v6i32/v6f32
Having type symmetry with these is somewhat necessary when implementing support for 192-bit values.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D104621
2021-06-24 12:41:22 +09:00
Yaxun (Sam) Liu 82e03e494f [HIP] Defer operator overloading errors
Although clang is able to defer overloading resolution
diagnostics for common functions. It does not defer
overloading resolution caused diagnostics for overloaded
operators.

This patch extends the existing deferred
diagnostic mechanism and defers a diagnostic caused
by overloaded operator.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D104505
2021-06-23 23:39:59 -04:00
Kai Luo 767e200b43 [PowerPC] Add test to show passes in O3 pipeline. NFC. 2021-06-24 03:20:35 +00:00
Arthur Eubanks e15673df27 [docs][NewPM] Add some instructions on how to invoke opt
Also add link to blog post.

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D104812
2021-06-23 19:49:35 -07:00
Peter Collingbourne 272af9c700 gn build: Build ubsan_minimal on Android. 2021-06-23 19:25:21 -07:00
Zequan Wu 9393894331 Revert "ThinLTO: Fix inline assembly references to static functions with CFI"
This casues compiler crash: Assertion `materialized_use_empty() && "Uses remain when a value is destroyed!"'

This reverts commit e3d24b45b8.
2021-06-23 19:24:56 -07:00
Peter Collingbourne e655e74a31 AST: Create __va_list in the std namespace even in C.
This ensures that the mangled type names match between C and C++,
which is significant when using -fsanitize=cfi-icall. Ideally we
wouldn't have created this namespace at all, but it's now part of
the ABI (e.g. in mangled names), so we can't change it.

Differential Revision: https://reviews.llvm.org/D104830
2021-06-23 18:59:10 -07:00
Evgenii Stepanov 78f7e6d8d7 [hwasan] Respect llvm.asan.globals.
This enable no_sanitize C++ attribute to exclude globals from hwasan
testing, and automatically excludes other sanitizers' globals (such as
ubsan location descriptors).

Differential Revision: https://reviews.llvm.org/D104825
2021-06-23 18:37:00 -07:00
Jon Chesterfield 660cae84c3 Revert "[AMDGPU] [IndirectCalls] Don't propagate attributes to address taken functions and their callees"
This reverts commit 6a3beb1f68.
Test case that triggers an infinite loop before the revert is at
the review for D103138.
2021-06-24 02:33:50 +01:00
Anthony Canino 3f429e82d3 Implement an scf.for range folding optimization pass.
In cases where arithmetic (addi/muli) ops are performed on an scf.for loops induction variable with a single use, we can fold those ops directly into the scf.for loop.

For example, in the following code:

```
scf.for %i = %c0 to %arg1 step %c1 {
  %0 = addi %arg2, %i : index
  %1 = muli %0, %c4 : index
  %2 = memref.load %arg0[%1] : memref<?xi32>
  %3 = muli %2, %2 : i32
  memref.store %3, %arg0[%1] : memref<?xi32>
}
```

we can lift `%0` up into the scf.for loop range, as it is the only user of %i:

```
%lb = addi %arg2, %c0 : index
%ub = addi %arg2, %i : index
scf.for %i = %lb to %ub step %c1 {
  %1 = muli %0, %c4 : index
  %2 = memref.load %arg0[%1] : memref<?xi32>
  %3 = muli %2, %2 : i32
  memref.store %3, %arg0[%1] : memref<?xi32>
}
```

Reviewed By: mehdi_amini, ftynse, Anthony

Differential Revision: https://reviews.llvm.org/D104289
2021-06-24 01:07:28 +00:00
Carl Ritson ae266e743c [LVI] Remove recursion from getValueForCondition (NFCI)
Convert getValueForCondition to a worklist model instead of using
recursion.

In pathological cases getValueForCondition recurses heavily.
Stack frames are quite expensive on x86-64, and some operating
systems (e.g. Windows) have relatively low stack size limits.
Using a worklist avoids potential failures from stack overflow.

Differential Revision: https://reviews.llvm.org/D104191
2021-06-24 09:58:22 +09:00
Whitney Tsang ab244db1fa [AIX] Emitting diagnostics error for profile options
Only LLVM-based instrumentation profile is supported on AIX.
And it currently must be used with full LTO.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D104803
2021-06-24 00:23:28 +00:00
modimo 42b99e094c [Clang] Check for returns_nonnull when deciding to add allocation null checks
Non-throwing allocators currently will always get null-check code. However, if the non-throwing allocator is explicitly annotated with returns_nonnull the null check should be elided.

Testing:
ninja check-all
added test case correctly elides

Reviewed By: bruno

Differential Revision: https://reviews.llvm.org/D102820
2021-06-23 17:15:12 -07:00
modimo a7b62699c8 [NFC] [DwarfEHPrepare] Add additional stats for EH
Stats added:

1. NumCleanupLandingPadsUnreachable: how many cleanup landing pads were optimized as unreachable
1. NumCleanupLandingPadsRemaining: how many cleanup landing pads remain
1. NumNoUnwind: Number of functions with nounwind attribute
1. NumUnwind: Number of functions with unwind attribute

DwarfEHPrepare is always run a single time as part of `TargetPassConfig::addISelPasses()` which makes it an ideal place near the end of the pipeline to record this information.

Example output from clang built with exceptions cumulative during thinLTO backend (NumCleanupLandingPadsUnreachable was not incremented):

	"dwarfehprepare.NumCleanupLandingPadsRemaining": 123660,
	"dwarfehprepare.NumNoUnwind": 323836,
	"dwarfehprepare.NumUnwind": 472893,

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D104161
2021-06-23 17:09:30 -07:00
Nick Desaulniers 24d48d45cc [LangRef] add note to warn-frame-size about ODR
As sugguested by @dblaikie in D104342.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D104736
2021-06-23 16:28:55 -07:00
Bill Wendling 826947080b [llvm-diff] Explicitly check ConstantStructs for differences
A ConstantStruct is renamed when the LLVM context sees a new one. This
makes global variable initializers appear different when they aren't.
Instead, check the ConstantStruct for equivalence.

Differential Revision: https://reviews.llvm.org/D104734
2021-06-23 16:26:34 -07:00
Craig Topper 91319534ba [CGP][RISCV] Teach CodeGenPrepare::optimizeSwitchInst to honor isSExtCheaperThanZExt.
This optimization pre-promotes the input and constants for a
switch instruction to a legal type so that all the generated compares
share the same extend. Since RISCV prefers sext for i32 to i64
extends, we should honor that to use sext.w instead of a pair
of shifts.

Reviewed By: jrtc27

Differential Revision: https://reviews.llvm.org/D104612
2021-06-23 15:38:11 -07:00
Xun Li f09ec01f1f [SjLj] Insert UnregisterFn before musttail call
When inserting UnregisterFn, if there is a musttail call, we must insert before the call so that we don't break the musttail call contract.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D104807
2021-06-23 15:33:55 -07:00
Xun Li f8c84da23b Revert "[SjLj] Insert UnregisterFn before musttail call"
This reverts commit f36703ada3.
Test failure: https://lab.llvm.org/buildbot#builders/104/builds/3450
2021-06-23 15:31:35 -07:00
Saleem Abdulrasool f38f81127c mailmap: add mappings for myself
Add aliases for various alternative email addresses.
2021-06-23 15:11:15 -07:00
Patrick Holland 70040de32d [MCA][TimelineView] Fixed a bug that was causing instructions outside of the timeline-max-cycles to still be printed.
Differential Revision: https://reviews.llvm.org/D104815
2021-06-23 15:05:49 -07:00
Xing Xue afd3607c8f [libc++abi][AIX] Enable calculating addresses with DW_EH_PE_datarel
Summary:
This patch enables calculating relative addresses with the DW_EH_PE_datarel encoding using a 'base' for AIX. After setting registers for jumping to the user code in gxx_personality_v0(), 'base' is cached in exception_header member catchTemp for use in __cxa_call_unexpected if ttypeIndex is less than 0 (exception spec).

Reviewed by: MaskRay, sfertile, compnerd, libc++abi

Differential Revision: https://reviews.llvm.org/D101298
2021-06-23 17:54:10 -04:00
Xun Li f36703ada3 [SjLj] Insert UnregisterFn before musttail call
When inserting UnregisterFn, if there is a musttail call, we must insert before the call so that we don't break the musttail call contract.

Differential Revision: https://reviews.llvm.org/D104807
2021-06-23 14:29:46 -07:00
Jacob Hegna 7c8a507272 Replace python3 with %python in ML inlining tests.
Differential Revision: https://reviews.llvm.org/D104818
2021-06-23 21:14:54 +00:00
Nikita Popov 70b1a8c095 [PatternMatch] Make m_VScale compatible with opaque pointers
Use GEP source type instead of pointer element type.
2021-06-23 23:02:13 +02:00
Roman Lebedev e6a353061f
[NFC][AArch64] Autogenerate assembly checklines in arm64-instruction-mix-remarks.ll 2021-06-24 00:01:13 +03:00
Alex Langford 5bebc0b177 [lldb] Decouple ObjCLanguage from Symtab
We can extend/modify `GetMethodNameVariants` to suit our purposes here.
What symtab is looking for is alternate names we may want to use to
search for a specific symbol, and asking for variants of a name makes
the most sense here.

Differential Revision: https://reviews.llvm.org/D104067
2021-06-23 13:49:46 -07:00
Emily Shi 05e48eccdd [NFC][compiler-rt] Remove iOS xfail for unpoison-alternate-stack
This test was originally xfailed because of a bug on iOS. This has since been fixed, so reenabling the test.
2021-06-23 13:47:56 -07:00
Siva Chandra Reddy d5700bb694 [libc] Calculate ulp error after rounding MPFR result to the result type.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D104615
2021-06-23 20:29:46 +00:00
Nico Weber ef75358080 [lld/mac] Delete incorrect FIXME
"""Bitcode symbols only exist before LTO runs, and only serve the purpose of
resolving visibility so LTO can better optimize. Running LTO creates ObjFiles
from BitcodeFiles, and those ObjFiles contain regular Defined symbols (with
isec set and all) that will replace the bitcode symbols. So things should
(hopefully) work as-is :)"""

  -- https://reviews.llvm.org/rGdbbc8d8333f29cf4ad6f4793da1adf71bbfdac69#inline-6081
2021-06-23 16:25:34 -04:00
Martin Storsjö 2716c6faa4 [flang] Tweak the conditions for the GCC 7/libstdc++ workaround
This adjusts the workaround from D104731.

The issue lies in libstdc++'s classes, not GCC itself, and manifests
itself in the same way if building e.g. with clang while using
libstdc++ headers from GCC 7 (e.g. if building with Clang on Ubuntu 18.04,
while using the system default C++ library).

Therefore, change the condition to look for the version of libstdc++
instead of the compiler.

Differential Revision: https://reviews.llvm.org/D104779
2021-06-23 23:19:32 +03:00
Michael Kruse 84046ebd95 [Polly] Fix test after D104732.
The SCEV analysis has been improved to identify a write access as a MustWrite.
2021-06-23 14:59:53 -05:00
Eli Friedman b12192f7cd [ScalarEvolution] Clarify implementation of getPointerBase().
getPointerBase should only be looking through Add and AddRec
expressions; other expressions either aren't pointers, or can't be
looked through.

Technically, this is a functional change. For a multiply or min/max
expression, if they have exactly one pointer operand, and that operand
is the first operand, the behavior here changes. Similarly, if an AddRec
has a pointer-type step, the behavior changes. But that shouldn't be
happening in practice, and we plan to make such expressions illegal.
2021-06-23 12:55:59 -07:00
Eli Friedman fdaf304e0d [NFC][ScalarEvolution] Fix SCEVNAryExpr::getType().
SCEVNAryExpr::getType() could return the wrong type for a SCEVAddExpr.
Remove it, and add getType() methods to the relevant subclasses.

NFC because nothing uses it directly, as far as I know; this is just
future-proofing.
2021-06-23 12:55:59 -07:00
Andrew Litteken 9e73f7c8d2 [IRSim] Adding basic implementation of llvm-sim.
This is a similarity visualization tool that accepts a Module and
passes it to the IRSimilarityIdentifier.  The resulting SimilarityGroups
are output in a JSON file.

Tests are found in test/tools/llvm-sim and check for the file not found,
a bad module, and that the JSON is created correctly.

Reviewers: paquette, jroelofs, MaskRay

Recommit of: 15645d044b to fix linking
errors and GN build system.

Differential Revision: https://reviews.llvm.org/D86974
2021-06-23 14:38:58 -05:00
Stanislav Mekhanoshin d274d64ef4 [AMDGPU] Check for pointer operand while refining LDS align
Also skips the propagation if alignment is 1.

Differential Revision: https://reviews.llvm.org/D104796
2021-06-23 12:27:55 -07:00
pooja2299 a15f9ff996 [docs][GISel]Added GISel documentation link
Added the GISel docs link here - https://llvm.org/docs/CodeGenerator.html#instruction-selection-section

Differential Revision: https://reviews.llvm.org/D104204
2021-06-24 00:55:00 +05:30
Duncan P. N. Exon Smith 3cf415c6c3 IR: Fix use-list-order round-tripping for call and invoke
Fix the use-list-order for call and invoke instructions by setting the
operands in order of their index. This matches the use-list-order
prediction. Note that the verifier precludes sharing operands in callbr
(so there was no bug to fix), but that code was updated for consistency.

Bug was found during review of https://reviews.llvm.org/D104740.

Differential Revision: https://reviews.llvm.org/D104805
2021-06-23 12:04:19 -07:00
Jian Cai 0eac975b51 Reland "[AArch64] handle -Wa,-march="
This reverts commit fd11a26d36, which was
reverted by 9145a3d4ab due to a test
failure on aarch64 backend, e.g.
https://lab.llvm.org/buildbot/#/builders/43/builds/7031. This patch
fixed the test failure.

Reviewed By: DavidSpickett, nickdesaulniers

Differential Revision: https://reviews.llvm.org/D103184
2021-06-23 12:01:57 -07:00
Adrian Prantl 7a38a757a1 Move dwarfdump-invalid.test into the tools/llvm-dwarfdump directory. 2021-06-23 12:00:34 -07:00