OSDN Git Service
Roman Lebedev [Tue, 1 Dec 2020 12:47:04 +0000 (15:47 +0300)]
Revert "[InstCombine] Improve vector undef handling for sext(ashr(shl(trunc()))) fold"
It seems i have missed checklines, temporairly reverting,
will reland momentairly..
This reverts commit
aa1aa135097ecfab6d9917a435142030eff0a226.
Roman Lebedev [Tue, 1 Dec 2020 12:33:12 +0000 (15:33 +0300)]
[NFC][InstCombine] sext.ll: @test9: avoid only differently-cased names for values and block names
Roman Lebedev [Tue, 1 Dec 2020 12:11:14 +0000 (15:11 +0300)]
[InstCombine] Improve vector undef handling for sext(ashr(shl(trunc()))) fold
If the shift amount was undef for some lane, the shift amount in opposite
shift is irrelevant for that lane, and the new shift amount for that lane
can be undef.
Roman Lebedev [Tue, 1 Dec 2020 12:04:40 +0000 (15:04 +0300)]
[NFC][InstCombine] Improve vector undef test coverage for sext(ashr(shl(trunc()))) fold
Roman Lebedev [Tue, 1 Dec 2020 12:00:15 +0000 (15:00 +0300)]
[InstCombine] Evaluate new shift amount for sext(ashr(shl(trunc()))) fold in wide type (PR48343)
It is not correct to compute that new shift amount in it's narrow type
and only then extend it into the wide type:
----------------------------------------
Optimization: PR48343 good
Precondition: (width(%X) == width(%r))
%o0 = trunc %X
%o1 = shl %o0, %Y
%o2 = ashr %o1, %Y
%r = sext %o2
=>
%n0 = sext %Y
%n1 = sub width(%o0), %n0
%n2 = sub width(%X), %n1
%n3 = shl %X, %n2
%r = ashr %n3, %n2
Done: 2016
Optimization is correct!
----------------------------------------
Optimization: PR48343 bad
Precondition: (width(%X) == width(%r))
%o0 = trunc %X
%o1 = shl %o0, %Y
%o2 = ashr %o1, %Y
%r = sext %o2
=>
%n0 = sub width(%o0), %Y
%n1 = sub width(%X), %n0
%n2 = sext %n1
%n3 = shl %X, %n2
%r = ashr %n3, %n2
Done: 1
ERROR: Domain of definedness of Target is smaller than Source's for i9 %r
Example:
%X i9 = 0x000 (0)
%Y i4 = 0x3 (3)
%o0 i4 = 0x0 (0)
%o1 i4 = 0x0 (0)
%o2 i4 = 0x0 (0)
%n0 i4 = 0x1 (1)
%n1 i4 = 0x8 (8, -8)
%n2 i9 = 0x1F8 (504, -8)
%n3 i9 = 0x000 (0)
Source value: 0x000 (0)
Target value: undef
I.e. we should be computing it in the wide type from the beginning.
Fixes https://bugs.llvm.org/show_bug.cgi?id=48343
Roman Lebedev [Tue, 1 Dec 2020 11:49:28 +0000 (14:49 +0300)]
[NFC][InstCombine] Add PR48343 miscompiled testcase
Roman Lebedev [Tue, 1 Dec 2020 11:48:46 +0000 (14:48 +0300)]
[NFC][InstCombine] Autogenerate sext.ll test checklines
Roman Lebedev [Tue, 1 Dec 2020 08:07:28 +0000 (11:07 +0300)]
[SimplifyCFG] FoldBranchToCommonDest: don't require that cmp of br is last instruction
There is no correctness need for that, and since we allow live-out
uses, this could theoretically happen, because currently nothing
will move the cond to right before the branch in those tests.
But regardless, lifting that restriction even makes the transform
easier to understand.
This makes the transform happen in 81 more cases (+0.55%)
)
Roman Lebedev [Tue, 1 Dec 2020 07:59:08 +0000 (10:59 +0300)]
[NFC][SimplifyCFG] fold-branch-to-common-dest: add tests with cond of br not being the last op
Simon Pilgrim [Tue, 1 Dec 2020 11:56:12 +0000 (11:56 +0000)]
[DAG] Move vselect(icmp_ult, -1, add(x,y)) -> uaddsat(x,y) to DAGCombine (PR40111)
Move the X86 VSELECT->UADDSAT fold to DAGCombiner - there's nothing target specific about these folds.
The SSE42 test diffs are relatively benign - its avoiding an extra constant load in exchange for an extra xor operation - there are extra register moves, which is annoying as all those operations should commute them away.
Differential Revision: https://reviews.llvm.org/D91876
Sven van Haastregt [Tue, 1 Dec 2020 11:33:10 +0000 (11:33 +0000)]
[OpenCL] Allow pointer-to-pointer kernel args beyond CL 1.2
The restriction on pointer-to-pointer kernel arguments has been
relaxed in OpenCL 2.0. Apply the same address space restrictions for
pointer argument types to the inner pointer types.
Differential Revision: https://reviews.llvm.org/D92091
Cullen Rhodes [Mon, 2 Nov 2020 13:02:32 +0000 (13:02 +0000)]
[LV] Clamp VF hint when unsafe
In the following loop the dependence distance is 2 and can only be
vectorized if the vector length is no larger than this.
void foo(int *a, int *b, int N) {
#pragma clang loop vectorize(enable) vectorize_width(4)
for (int i=0; i<N; ++i) {
a[i + 2] = a[i] + b[i];
}
}
However, when specifying a VF of 4 via a loop hint this loop is
vectorized. According to [1][2], loop hints are ignored if the
optimization is not safe to apply.
This patch introduces a check to bail of vectorization if the user
specified VF is greater than the maximum feasible VF, unless explicitly
forced with '-force-vector-width=X'.
[1] https://llvm.org/docs/LangRef.html#llvm-loop-vectorize-and-llvm-loop-interleave
[2] https://clang.llvm.org/docs/LanguageExtensions.html#extensions-for-loop-hint-optimizations
Reviewed By: sdesmalen, fhahn, Meinersbur
Differential Revision: https://reviews.llvm.org/D90687
Simon Pilgrim [Tue, 1 Dec 2020 10:59:53 +0000 (10:59 +0000)]
[InstCombine][X86] Fold addsub intrinsic to fadd/fsub depending on demanded elts (PR46277)
Caroline Concatto [Mon, 16 Nov 2020 10:14:28 +0000 (10:14 +0000)]
[NFC][CostModel]Extend class IntrinsicCostAttributes to use ElementCount Type
This patch replaces the attribute `unsigned VF` in the class
IntrinsicCostAttributes by `ElementCount VF`.
This is a non-functional change to help upcoming patches to compute the cost
model for scalable vector inside this class.
Differential Revision: https://reviews.llvm.org/D91532
Kadir Cetinkaya [Tue, 1 Dec 2020 08:58:56 +0000 (09:58 +0100)]
[clang] Enable code completion of designated initializers in Compound Literal Expressions
PreferedType were not set when parsing compound literals, hence
designated initializers were not available as code completion suggestions.
This patch sets the preferedtype to parsed type for the following initializer
list.
Fixes https://github.com/clangd/clangd/issues/142.
Differential Revision: https://reviews.llvm.org/D92370
Florian Hahn [Mon, 30 Nov 2020 15:26:51 +0000 (15:26 +0000)]
[ConstraintElimination] Decompose GEP %ptr, SHL().
Add support the decompose a GEP with an SHL operand.
Kazushi (Jam) Marukawa [Fri, 27 Nov 2020 13:19:43 +0000 (22:19 +0900)]
[VE] Add vadd and vsub intrinsic instructions
Add vadd and vsub intrinsic instructions and regression tests.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D92332
Simon Pilgrim [Tue, 1 Dec 2020 10:35:52 +0000 (10:35 +0000)]
[InstCombine][X86] Add test coverage showing failure to simplify addsub intrinsics to fadd/fsub
If we only use odd/even lanes then we just need fadd/fsub ops
Sjoerd Meijer [Tue, 1 Dec 2020 09:17:10 +0000 (09:17 +0000)]
ExtractValue instruction costs
Instruction ExtractValue wasn't handled in
LoopVectorizationCostModel::getInstructionCost(). As a result, it was modeled
as a mul which is not really accurate. Since it is free (most of the times),
this now gets a cost of 0 using getInstructionCost.
This is a follow-up of D92208, that required changing this regression test.
In a follow up I will look at InsertValue which also isn't handled yet.
Differential Revision: https://reviews.llvm.org/D92317
David Green [Tue, 1 Dec 2020 10:40:04 +0000 (10:40 +0000)]
[AArch64] Update pass pipeline test. NFC
David Green [Tue, 1 Dec 2020 09:04:36 +0000 (09:04 +0000)]
[ARM] PREDICATE_CAST demanded bits
The PREDICATE_CAST node is used to model moves between MVE predicate
registers and gpr's, and eventually become a VMSR p0, rn. When moving to
a predicate only the bottom 16 bits of the sources register are
demanded. This adds a simple fold for that, allowing it to potentially
remove instructions like uxth.
Differential Revision: https://reviews.llvm.org/D92213
Jay Foad [Tue, 1 Dec 2020 10:15:22 +0000 (10:15 +0000)]
[AMDGPU] Simplify some generation checks. NFC.
Hans Wennborg [Tue, 1 Dec 2020 10:14:48 +0000 (11:14 +0100)]
[gn build] Manually merge
40659cd
Georgii Rymar [Tue, 10 Nov 2020 13:33:57 +0000 (16:33 +0300)]
[obj2yaml] - Teach tool to emit the "SectionHeaderTable" key and sort sections by file offset.
Currently when we dump sections, we dump them in the order,
which is specified in the sections header table.
With that the order in the output might not match the order in the file.
This patch starts sorting them by by file offsets when dumping.
When the order in the section header table doesn't match the order
in the file, we should emit the "SectionHeaderTable" key. This patch does it.
Differential revision: https://reviews.llvm.org/D91249
Jan Svoboda [Tue, 1 Dec 2020 09:40:50 +0000 (10:40 +0100)]
[clang][cli] Port HeaderSearch option flags to new option parsing system
Depends on D83697.
Reviewed By: dexonsmith
Original patch by Daniel Grumberg.
Differential Revision: https://reviews.llvm.org/D83940
Georgii Rymar [Mon, 30 Nov 2020 13:16:34 +0000 (16:16 +0300)]
[llvm-readobj][test] - Merge 2 test cases together.
This merges `invalid-attr-section-size.test` and `invalid-attr-version.test`
into `invalid-attributes-sec.test`.
This allows to have a single place where other related test cases can be added.
Differential revision: https://reviews.llvm.org/D92316
David Chisnall [Tue, 1 Dec 2020 09:48:25 +0000 (09:48 +0000)]
[GNU ObjC] Fix a regression listing methods twice.
Methods synthesized from declared properties were being added to the
method lists twice. This came from the change to list them in the
class's method list, which missed removing the place in CGObjCGNU that
added them again.
Reviewed By: lanza
Differential Revision: https://reviews.llvm.org/D91874
Georgii Rymar [Tue, 1 Dec 2020 09:08:46 +0000 (12:08 +0300)]
[llvm-readobj] - Introduce `ObjDumper::reportUniqueWarning(const Twine &Msg)`.
This introduces the overload for `reportUniqueWarning` which allows
to avoid using `createError` in many places.
Differential revision: https://reviews.llvm.org/D92371
Jan Svoboda [Fri, 20 Nov 2020 11:49:51 +0000 (12:49 +0100)]
[clang][cli] Port DependencyOutput option flags to new option parsing system
Depends on D91861.
Reviewed By: dexonsmith
Original patch by Daniel Grumberg.
Differential Revision: https://reviews.llvm.org/D83694
Eugene Zhulenev [Tue, 1 Dec 2020 08:44:32 +0000 (00:44 -0800)]
[mlir] AsyncRuntime: disable threading until test flakiness is fixed
ExecutionEngine/LLJIT do not run globals destructors in loaded dynamic libraries when destroyed, and threads managed by ThreadPool can race with program termination, and it leads to segfaults.
TODO: Re-enable threading after fixing a problem with destructors, or removing static globals from dynamic library.
Differential Revision: https://reviews.llvm.org/D92368
Jan Svoboda [Fri, 20 Nov 2020 11:49:51 +0000 (12:49 +0100)]
[clang][cli] Port Frontend option flags to new option parsing system
Depends on D91861.
Reviewed By: dexonsmith
Original patch by Daniel Grumberg.
Differential Revision: https://reviews.llvm.org/D83697
Jan Svoboda [Fri, 20 Nov 2020 11:49:51 +0000 (12:49 +0100)]
[clang][cli] Split DefaultAnyOf into a default value and ImpliedByAnyOf
This makes the options API composable, allows boolean flags to imply non-boolean values and makes the code more logical (IMO).
Differential Revision: https://reviews.llvm.org/D91861
Jan Svoboda [Fri, 20 Nov 2020 09:26:07 +0000 (10:26 +0100)]
[clang][cli] Factor out call to EXTRACTOR in generateCC1CommandLine (NFC)
Reviewed By: Bigcheese, dexonsmith
Original patch by Daniel Grumberg.
Differential Revision: https://reviews.llvm.org/D83211
Kristof Beyls [Mon, 30 Nov 2020 12:43:44 +0000 (13:43 +0100)]
collect_and_build_with_pgo.py: adapt to monorepo
Differential Revision: https://reviews.llvm.org/D92328
Georgii Rymar [Fri, 27 Nov 2020 08:57:03 +0000 (11:57 +0300)]
[llvm-readelf] - Switch to using from `reportWarning` to `reportUniqueWarning` in `DynRegionInfo`.
This is a part of the plan we had previously to convert all calls to
`reportUniqueWarning` and then rename it to just `reportWarning`.
I was a bit unsure about this particular change at first, because it doesn't add a
new functionality: seems it is impossible to trigger a warning duplication currently.
At the same time I find the idea of the plan mentioned very reasonable.
And with that we will be sure that `DynRegionInfo` can't report duplicate
warnings, what looks like a nice feature for possible refactorings and further tool development.
Differential revision: https://reviews.llvm.org/D92224
Martin Storsjö [Fri, 20 Nov 2020 09:29:27 +0000 (11:29 +0200)]
[compiler-rt] [emutls] Handle unused parameters in a compiler agnostic way
The MSVC specific pragmas disable this warning, but the pragmas themselves
(when not guarded by any _MSC_VER ifdef) cause warnings for other targets,
e.g. when targeting mingw.
Instead silence the MSVC warnings about unused parameters by casting
the parameters to void.
Differential Revision: https://reviews.llvm.org/D91851
Georgii Rymar [Fri, 27 Nov 2020 10:34:30 +0000 (13:34 +0300)]
[llvm-readelf/obj] - Move unique warning handling logic to the `ObjDumper`.
This moves the `reportUniqueWarning` method to the base class.
My motivation is the following:
I've experimented with replacing `reportWarning` calls with `reportUniqueWarning`
in ELF dumper. I've found that for example for removing them from `DynRegionInfo` helper
class, it is worth to pass a dumper instance to it (to be able to call dumper()->reportUniqueWarning()).
The problem was that `ELFDumper<ELFT>` is a template class. I had to make `DynRegionInfo` to be templated
and do lots of minor changes everywhere what did not look reasonable/nice.
At the same time I guess one day other dumpers like COFF/MachO/Wasm etc might want to
start using `reportUniqueWarning` API too. Then it looks reasonable to move the logic to the
base class.
With that the problem of passing the dumper instance will be gone.
Differential revision: https://reviews.llvm.org/D92218
Kazu Hirata [Tue, 1 Dec 2020 06:28:26 +0000 (22:28 -0800)]
[CodeView] Remove unused declaration collectInlineSiteChildren (NFC)
The function definition was removed on Sep 7, 2016 in commit
a9f4cc9510546f5728258524d344a3e03e43500b. The declaration seems to be
unused since then.
Wei Wang [Tue, 17 Nov 2020 18:43:02 +0000 (10:43 -0800)]
[Remarks][2/2] Expand remarks hotness threshold option support in more tools
This is the #2 of 2 changes that make remarks hotness threshold option
available in more tools. The changes also allow the threshold to sync with
hotness threshold from profile summary with special value 'auto'.
This change expands remarks hotness threshold option
-fdiagnostics-hotness-threshold in clang and *-remarks-hotness-threshold in
other tools to utilize hotness threshold from profile summary.
Remarks hotness filtering relies on several driver options. Table below lists
how different options are correlated and affect final remarks outputs:
| profile | hotness | threshold | remarks printed |
|---------|---------|-----------|-----------------|
| No | No | No | All |
| No | No | Yes | None |
| No | Yes | No | All |
| No | Yes | Yes | None |
| Yes | No | No | All |
| Yes | No | Yes | None |
| Yes | Yes | No | All |
| Yes | Yes | Yes | >=threshold |
In the presence of profile summary, it is often more desirable to directly use
the hotness threshold from profile summary. The new argument value 'auto'
indicates threshold will be synced with hotness threshold from profile summary
during compilation. The "auto" threshold relies on the availability of profile
summary. In case of missing such information, no remarks will be generated.
Differential Revision: https://reviews.llvm.org/D85808
Wei Wang [Tue, 17 Nov 2020 18:37:59 +0000 (10:37 -0800)]
[Remarks][1/2] Expand remarks hotness threshold option support in more tools
This is the #1 of 2 changes that make remarks hotness threshold option
available in more tools. The changes also allow the threshold to sync with
hotness threshold from profile summary with special value 'auto'.
This change modifies the interface of lto::setupLLVMOptimizationRemarks() to
accept remarks hotness threshold. Update all the tools that use it with remarks
hotness threshold options:
* lld: '--opt-remarks-hotness-threshold='
* llvm-lto2: '--pass-remarks-hotness-threshold='
* llvm-lto: '--lto-pass-remarks-hotness-threshold='
* gold plugin: '-plugin-opt=opt-remarks-hotness-threshold='
Differential Revision: https://reviews.llvm.org/D85809
Greg Parker [Sun, 29 Nov 2020 01:54:29 +0000 (17:54 -0800)]
[DSE] Remove a redundant call to getLocForWriteEx()
Differential Revision: https://reviews.llvm.org/D92263
Raman Tenneti [Tue, 1 Dec 2020 05:06:47 +0000 (21:06 -0800)]
Initial commit of mktime.
This introduces mktime to LLVM libc, based on C99/C2X/Single Unix Spec.
Co-authored-by: Jeff Bailey <jeffbailey@google.com>
This change doesn't handle TIMEZONE, tm_isdst and leap seconds. It returns -1 for invalid dates. I have verified the return results for all the possible dates with glibc's mktime.
TODO:
+ Handle leap seconds.
+ Handle out of range time and date values that don't overflow or underflow.
+ Implement the following suggestion Siva - As we start accumulating the seconds, we should be able to check if the next amount of seconds to be added can lead to an overflow. If it does, return the overflow value. If not keep accumulating. The benefit is that, we don't have to validate every input, and also do not need the special cases for sizeof(time_t) == 4.
+ Handle timezone and update of tm_isdst
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D91551
Craig Topper [Tue, 1 Dec 2020 04:15:04 +0000 (20:15 -0800)]
[RISCV] Rename RISCVGenSystemOperands.inc to RISCVGenSearchableTables.inc to prepare for more tables. NFC
D89449 adds more tables so renaming as a pre-commit for that.
Hendrik Greving [Thu, 12 Nov 2020 01:56:14 +0000 (17:56 -0800)]
Add MachineModuleInfo constructor with external MCContext
Adds a constructor to MachineModuleInfo and MachineModuleInfoWapperPass that
takes an external MCContext. If provided, the external context will be used
throughout codegen instead of MMI's default one.
This enables external drivers to take ownership of data put on the MMI's context
during codegen. The internal context is used otherwise and destroyed upon
finish.
Differential Revision: https://reviews.llvm.org/D91313
Jonas Devlieghere [Mon, 30 Nov 2020 23:18:24 +0000 (15:18 -0800)]
[lldb] Refactor GetDeviceSupportDirectoryNames and GetPlatformName (NFC)
Both functions are effectively returning a single string literal. Change
the interface to return a llvm::StringRef instead of populating a vector
of std::strings or returning a std::string respectively.
Yaxun (Sam) Liu [Mon, 30 Nov 2020 19:48:56 +0000 (14:48 -0500)]
Add help text for -nogpuinc
Differential Revision: https://reviews.llvm.org/D92339
Leonard Chan [Tue, 1 Dec 2020 03:21:35 +0000 (19:21 -0800)]
Revert "[clang][Fuchsia] Add relative-vtables multilib"
This reverts commit
fdbd84c6c819d4462546961f6086c1524d5d5ae8.
Reverting due to failing CI builders for Fuchsia's toolchain:
https://luci-milo.appspot.com/p/fuchsia/builders/ci/clang-linux-x64/
b8862150211240186992?
Fangrui Song [Tue, 1 Dec 2020 02:31:42 +0000 (18:31 -0800)]
[GlobalISel] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds
Fangrui Song [Tue, 1 Dec 2020 02:25:53 +0000 (18:25 -0800)]
[GlobalISel] Fix -Wunused-variable
Leonard Chan [Tue, 1 Dec 2020 02:21:10 +0000 (18:21 -0800)]
[clang][Fuchsia] Add relative-vtables multilib
This adds multilibs for Fuchsia that is built with the relative vtables ABI,
one with and another without exceptions.
Differential Revision: https://reviews.llvm.org/D85576
Leonard Chan [Tue, 1 Dec 2020 02:19:50 +0000 (18:19 -0800)]
Revert "[clang][Fuchsia] Add relative-vtables multilib"
This reverts commit
7c2bc3b71dc072987d43a2a86609871bd01f981f.
Forgot to add the ifferential revision.
Leonard Chan [Mon, 19 Oct 2020 20:42:40 +0000 (13:42 -0700)]
[clang][Fuchsia] Add relative-vtables multilib
This adds a multilib for Fuchsia that is built with the relative vtables
ABI.
Amy Huang [Mon, 30 Nov 2020 22:35:15 +0000 (14:35 -0800)]
Recommit "[llvm-symbolizer] Switch to using native symbolizer by default on Windows"
This reverts commit
1b63177a56e8cd6196778d2b90295f03e96b5800.
Leonard Chan [Tue, 1 Dec 2020 01:18:50 +0000 (17:18 -0800)]
[llvm] Fix for failing test from
cf8ff75bade763b054476321dcb82dcb2e7744c7
Handle null values when handling operand changes for DSOLocalEquivalent.
Ray (I-Jui) Sung [Tue, 1 Dec 2020 00:22:36 +0000 (00:22 +0000)]
Don't count attributes when addressing operands.
Fixes out-of-bound access in generated nested DAG rewriter matching code.
Reviewed By: tpopp
Differential Revision: https://reviews.llvm.org/D92075
Duncan P. N. Exon Smith [Thu, 29 Oct 2020 19:29:42 +0000 (15:29 -0400)]
Lex: Update Module::findHeader to return FileEntryRef, NFC
Update `Module::findHeader` to return `Optional<FileEntryRef>` and
fix its one caller.
Differential Revision: https://reviews.llvm.org/D90485
Sean Silva [Mon, 30 Nov 2020 23:20:30 +0000 (15:20 -0800)]
[mlir] Small cleanups to func-bufferize/finalizing-bufferize
- Address TODO in scf-bufferize: the argument materialization issue is
now fixed and the code is now in Transforms/Bufferize.cpp
- Tighten up finalizing-bufferize to avoid creating invalid IR when
operand types potentially change
- Tidy up the testing of func-bufferize, and move appropriate tests
to a new finalizing-bufferize.mlir
- The new stricter checking in finalizing-bufferize revealed that we
needed a DimOp conversion pattern (found when integrating into npcomp).
Previously, the converion infrastructure was blindly changing the
operand type during finalization, which happened to work due to
DimOp's tensor/memref polymorphism, but is generally not encouraged
(the new pattern is the way to tell the conversion infrastructure that
it is legal to change that type).
Nico Weber [Mon, 30 Nov 2020 01:17:56 +0000 (20:17 -0500)]
clang/test: Remove platform-linker feature
By explicitly requesting the system linker with `-fuse-ld=`, the
tests are able to CHECK for the system linker even with
CLANG_DEFAULT_LINKER=lld.
Alternative to D74704.
Differential Revision: https://reviews.llvm.org/D92291
Reid Kleckner [Mon, 30 Nov 2020 18:21:14 +0000 (10:21 -0800)]
[WinASan] Improve exception reporting accuracy
Previously, ASan would produce reports like this:
ERROR: AddressSanitizer: breakpoint on unknown address 0x000000000000 (pc 0x7fffdd7c5e86 ...)
This is unhelpful, because the developer may think this is a null
pointer dereference, and not a breakpoint exception on some PC.
The cause was that SignalContext::GetAddress would read the
ExceptionInformation array to retreive an address for any kind of
exception. That data is only available for access violation exceptions.
This changes it to be conditional on the exception type, and to use the
PC otherwise.
I added a variety of tests for common exception types:
- int div zero
- breakpoint
- ud2a / illegal instruction
- SSE misalignment
I also tightened up IsMemoryAccess and GetWriteFlag to check the
ExceptionCode rather than looking at ExceptionInformation[1] directly.
Differential Revision: https://reviews.llvm.org/D92344
Amara Emerson [Tue, 17 Nov 2020 20:09:31 +0000 (12:09 -0800)]
[AArch64][GlobalISel] Fix crash during legalization of a vector G_SELECT with scalar mask.
The lowering of vector selects needs to first splat the scalar mask into a vector
first.
This was causing a crash when building oggenc in the test suite.
Differential Revision: https://reviews.llvm.org/D91655
Zequan Wu [Mon, 30 Nov 2020 22:09:00 +0000 (14:09 -0800)]
[libcxx] remove checks for __STDCPP_THREADS__ as it is defined by compiler
Differential Revision: https://reviews.llvm.org/D92349
Reid Kleckner [Mon, 30 Nov 2020 23:43:48 +0000 (15:43 -0800)]
Fix GCC 5.3 compile error in ASTImporter code
Try to simplify this code a different way: use less Expected, more
outparams.
Nick Desaulniers [Tue, 1 Dec 2020 00:02:28 +0000 (16:02 -0800)]
[InlineCost] prefer range-for. NFC
Prefer range-for over iterators when such methods exist. Precommitted
from https://reviews.llvm.org/D91816.
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D92350
Leonard Chan [Tue, 14 Jul 2020 21:56:38 +0000 (14:56 -0700)]
[clang][RelativeVTablesABI] Use dso_local_equivalent rather than emitting stubs
Thanks to D77248, we can bypass the use of stubs altogether and use PLT
relocations if they are available for the target. LLVM and LLD support the
R_AARCH64_PLT32 relocation, so we can also guarantee a static PLT relocation on AArch64.
Not emitting these stubs saves a lot of extra binary size.
Differential Revision: https://reviews.llvm.org/D83812
Amy Huang [Mon, 30 Nov 2020 23:08:00 +0000 (15:08 -0800)]
[llvm-symbolizer] Fix typo in llvm-symbolizer test from a previous commit.
(Commit was
00bbef2bb20cf212722de282e4eb9afd09ab50db)
Duncan P. N. Exon Smith [Mon, 30 Nov 2020 22:12:28 +0000 (14:12 -0800)]
Remove dead code added in
ac49500cd0484e1b2dcf37fa4c0dade6f113c2c9, NFC
This was a copy/paste bug; `M0` is never referenced later.
Duncan P. N. Exon Smith [Thu, 29 Oct 2020 22:00:31 +0000 (18:00 -0400)]
FileManager: Add FileEntryRef::getDir, returning DirectoryEntryRef
Add `FileEntryRef::getDir`, which returns a `DirectoryEntryRef`. This
includes a few changes:
- Customize `OptionalStorage` so that `Optional<DirectoryEntryRef>` is
pointer-sized (like the change made to `Optional<FileEntryRef>`).
Factored out a common class, `FileMgr::MapEntryOptionalStorage`, to
reduce the code duplication.
- Store an `Optional<DirectoryEntryRef>` in `FileEntryRef::MapValue`.
This is set if and only if `MapValue` has a real `FileEntry`.
- Change `FileManager::getFileRef` and `getVirtualFileRef` to use
`getDirectoryRef` and store it in the `StringMap` for `FileEntryRef`.
Differential Revision: https://reviews.llvm.org/D90484
Jonas Devlieghere [Mon, 30 Nov 2020 22:41:33 +0000 (14:41 -0800)]
[lldb] Give TestDefaultTemplateArgs a unique class name
Multiple tests cannot share the same test class name.
Amy Huang [Wed, 25 Nov 2020 17:22:17 +0000 (09:22 -0800)]
[llvm-symbolizer] Fix native symbolization on windows for inline sites.
The existing code handles this correctly and I checked that the code
in NativeInlineSiteSymbol also handles this correctly, but it was
wrong in the NativeFunctionSymbol code.
Differential Revision: https://reviews.llvm.org/D92134
Joachim Protze [Mon, 30 Nov 2020 22:16:56 +0000 (23:16 +0100)]
[OpenMP][Tests][NFC] Use FileCheck from cmake config
Duncan P. N. Exon Smith [Thu, 22 Oct 2020 03:38:12 +0000 (23:38 -0400)]
Serialization: Change InputFile to use FileEntryRef and add getVirtualFileRef, NFC
Change the `InputFile` class to store `Optional<FileEntryRef>` instead
of `FileEntry*`. This paged in a few API changes:
- Added `FileManager::getVirtualFileRef`, and converted `getVirtualFile`
to a wrapper of it.
- Updated `SourceManager::bypassFileContentsOverride` to take
`FileEntryRef` and return `Optional<FileEntryRef>`
(`ASTReader::getInputFile` is the only caller).
Differential Revision: https://reviews.llvm.org/D90053
Todd Erdner [Mon, 30 Nov 2020 21:39:52 +0000 (00:39 +0300)]
[OpenMP] libomp: change shm name to include UID, call unregister_lib on SIGTERM
With the change to using shared memory, there were a few problems that need to be fixed.
- The previous filename that was used for SHM only used process id. Given that process is
usually based on 16bit number, this was causing some conflicts on machines. Thus we add
UID to the name to prevent this.
- It appears under some conditions (SIGTERM, etc) the shared memory files were not getting
cleaned up. Added a call to clean up the shm files under those conditions. For this user
needs to set envirable KMP_HANDLE_SIGNALS to true.
Patch by Erdner, Todd <todd.erdner@intel.com>
Differential Revision: https://reviews.llvm.org/D91869
AndreyChurbanov [Mon, 30 Nov 2020 21:13:31 +0000 (00:13 +0300)]
[OpenMP] libomp: fix mutexinoutset dependence for proxy tasks
Once __kmp_task_finish is not executed for proxy tasks,
move mutexinoutset dependency code to __kmp_release_deps
which is executed for all task kinds.
Differential Revision: https://reviews.llvm.org/D92326
Nico Weber [Mon, 23 Nov 2020 15:59:38 +0000 (10:59 -0500)]
[lld/mac] Don't warn on -bundle and -execute flags
They've been implemented since D87856 but since they still were
HelpHidden, the driver still warned claiming they were implemented.
Remove HelpHidden.
Use -fatal_warnings to test that the flags now don't warn. The
test depends on D91894 and D91891 to pass.
Differential Revision: https://reviews.llvm.org/D91971
Nico Weber [Fri, 20 Nov 2020 21:05:33 +0000 (16:05 -0500)]
[lld-macho] Don't warn on non-existent system libraries
Now, new mach-o lld no longer warns if the isysroot has just
usr/lib and System/Library/Frameworks but is missing usr/local/lib
and System/Frameworks.
This matches ld64 and old mach-o lld and fixes a regression from D85992.
It also fixes the only test failure in `check-lld` when running it
on an M1 Mac.
Differential Revision: https://reviews.llvm.org/D91891
Aaron En Ye Shi [Mon, 30 Nov 2020 20:53:17 +0000 (20:53 +0000)]
[HIP] Fix HIP test on windows due to lld suffix
On Windows, lld is instead named lld.exe, therefore
a few HIP tests are failing. Instead the wildcard should
be modified to .*lld.* to handle .exe. This fixes the
bug: https://bugs.llvm.org/show_bug.cgi?id=48289.
Differential Revision: https://reviews.llvm.org/D92342
Fangrui Song [Mon, 30 Nov 2020 20:44:35 +0000 (12:44 -0800)]
[CodeGen] -fno-delete-null-pointer-checks: change dereferenceable to dereferenceable_or_null
After D17993, with -fno-delete-null-pointer-checks we add the dereferenceable attribute to the `this` pointer.
We have observed that one internal target which worked before fails even with -fno-delete-null-pointer-checks.
Switching to dereferenceable_or_null fixes the problem.
dereferenceable currently does not always respect NullPointerIsValid and may
imply nonnull and lead to aggressive optimization. The optimization may be
related to `CallBase::isReturnNonNull`, `Argument::hasNonNullAttr`, or
`Value::getPointerDereferenceableBytes`. See D66664 and D66618 for some discussions.
Reviewed By: bkramer, rsmith
Differential Revision: https://reviews.llvm.org/D92297
Florian Hahn [Mon, 30 Nov 2020 16:47:28 +0000 (16:47 +0000)]
[ConstraintElimination] Expand GEP decomposition tests.
This adjusts the tests to cover more scenarios.
Paul Robinson [Mon, 30 Nov 2020 19:42:08 +0000 (11:42 -0800)]
[FastISel] NFC: Clean up unnecessary bookkeeping
Now that we flush the local value map for every instruction, we don't
need any extra flushes for specific cases. Also, LastFlushPoint is
not used for anything. Follow-ups to #
dc35368 (D91734).
Differential Revision: https://reviews.llvm.org/D92338
Tom Stellard [Mon, 30 Nov 2020 20:25:43 +0000 (12:25 -0800)]
github actions: Use correct credentials for pushing
Yitzhak Mandelbaum [Mon, 30 Nov 2020 19:55:15 +0000 (19:55 +0000)]
[libTooling] Remove deprecated Clang Transformer declarations
A number of declarations were leftover after the move from `clang::tooling` to
`clang::transformer`. This patch removes those declarations and upgrades the
handful of references to the deprecated declarations.
Differential Revision: https://reviews.llvm.org/D92340
Eric Astor [Mon, 30 Nov 2020 19:35:46 +0000 (14:35 -0500)]
[ms] [llvm-ml] Test macro function invocations in arbitrary positions
Differential Revision: https://reviews.llvm.org/D89741
Matt Arsenault [Mon, 30 Nov 2020 19:59:21 +0000 (14:59 -0500)]
SplitKit: Use Register
Mircea Trofin [Mon, 16 Nov 2020 22:01:53 +0000 (14:01 -0800)]
[llvm][inliner] Reuse the inliner pass to implement 'always inliner'
Enable performing mandatory inlinings upfront, by reusing the same logic
as the full inliner, instead of the AlwaysInliner. This has the
following benefits:
- reduce code duplication - one inliner codebase
- open the opportunity to help the full inliner by performing additional
function passes after the mandatory inlinings, but before th full
inliner. Performing the mandatory inlinings first simplifies the problem
the full inliner needs to solve: less call sites, more contextualization, and,
depending on the additional function optimization passes run between the
2 inliners, higher accuracy of cost models / decision policies.
Note that this patch does not yet enable much in terms of post-always
inline function optimization.
Differential Revision: https://reviews.llvm.org/D91567
Nikita Popov [Mon, 30 Nov 2020 17:33:07 +0000 (18:33 +0100)]
[DL] Inline getAlignmentInfo() implementation (NFC)
Apart from getting the entry in the table (which is already a
separate function), the remaining logic is different for all
alignment types and is better combined with getAlignment().
This is a minor efficiency improvement, and should make further
improvements like using separate storage for different alignment
types simpler.
Nick Lewycky [Mon, 30 Nov 2020 19:34:12 +0000 (11:34 -0800)]
Creating a named struct requires only a Context and a name, but looking up a struct by name requires a Module. The method on Module merely accesses the LLVMContextImpl and no data from the module itself, so this patch moves getTypeByName to a static method on StructType that takes a Context and a name.
There's a small number of users of this function, they are all updated.
This updates the C API adding a new method LLVMGetTypeByName2 that takes a context and a name.
Differential Revision: https://reviews.llvm.org/D78793
Eric Astor [Mon, 30 Nov 2020 16:35:24 +0000 (11:35 -0500)]
[ms] [llvm-ml] Implement the statement expansion operator
If prefaced with a %, expand text macros and macro functions in any statement.
Also, prevent expanding text macros in the message of an ECHO directive unless expanded explicitly by the statement expansion operator.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D89740
Sanjay Patel [Mon, 30 Nov 2020 18:56:08 +0000 (13:56 -0500)]
[x86] add tests for maxnum/minnum with nnan; NFC
Sjoerd Meijer [Mon, 30 Nov 2020 17:37:41 +0000 (17:37 +0000)]
[AArch64] Enable Cortex-A55 schedmodel
The model was committed in
4b8ade837e36b7f0181ce86fc23f33851d0fdd35
but not yet enabled to allow for a few fix ups. This adds a few
of these fixes, and also a LLVM MCA test to check most instructions.
While I do have plans to look into some more tuning, it's time to
enable this as it better than using the A53 schedule.
Differential Revision: https://reviews.llvm.org/D88017
Hongtao Yu [Mon, 30 Nov 2020 19:18:34 +0000 (11:18 -0800)]
[CSSPGO] Disabling a pseudo probe test on non-x86 platforms.
Disabling a pseudo probe test on non-x86 platforms since it's not fully tested there.
Paul Robinson [Mon, 30 Nov 2020 18:24:08 +0000 (10:24 -0800)]
[FastISel] NFC: Remove obsolete -fast-isel-sink-local-values option
This option is not used for anything after #
dc35368 (D91734).
Harald van Dijk [Mon, 30 Nov 2020 18:51:23 +0000 (18:51 +0000)]
[X86] Zero-extend pointers to i64 for x86_64
For LP64 mode, this has no effect as pointers are already 64 bits.
For ILP32 mode (x32), this extension is specified by the ABI.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D91338
Leonard Chan [Mon, 6 Apr 2020 23:08:58 +0000 (16:08 -0700)]
[libcxxabi] Add macro for changing functions to support the relative vtables ABI
Under the relative vtables ABI, __dynamic_cast will not work since it assumes
the vtable pointer is 2 ptrdiff_ts away from the start of the vtable (8-byte
offset to top + 8-byte pointer to typeinfo) when it is actually 8 bytes away
(4-byte offset to top + 4-byte offset to typeinfo). This adjusts the logic under
__dynamic_cast and other areas vtable calculations are done to support this ABI
when it's used.
Differential Revision: https://reviews.llvm.org/D77606
Simon Pilgrim [Mon, 30 Nov 2020 18:39:00 +0000 (18:39 +0000)]
[InstCombine][X86] Add basic addsub intrinsic SimplifyDemandedVectorElts support (PR46277)
Pass through the demanded elts mask to the source operands.
The next step will be to add support for folding to add/sub if we only demand odd/even elements.
LLVM GN Syncbot [Mon, 30 Nov 2020 18:20:24 +0000 (18:20 +0000)]
[gn build] Port
64fa8cce225
Hongtao Yu [Tue, 18 Aug 2020 23:28:47 +0000 (16:28 -0700)]
[CSSPGO] A Clang switch -fpseudo-probe-for-profiling for pseudo-probe instrumentation.
This change introduces a new clang switch `-fpseudo-probe-for-profiling` to enable AutoFDO with pseudo instrumentation. Please refer to https://reviews.llvm.org/D86193 for the whole story.
One implication from pseudo-probe instrumentation is that the profile is now sensitive to CFG changes. We perform the pseudo instrumentation very early in the pre-LTO pipeline, before any CFG transformation. This ensures that the CFG instrumented and annotated is stable and optimization-resilient.
The early instrumentation also allows the inliner to duplicate probes for inlined instances. When a probe along with the other instructions of a callee function are inlined into its caller function, the GUID of the callee function goes with the probe. This allows samples collected on inlined probes to be reported for the original callee function.
Reviewed By: wmi
Differential Revision: https://reviews.llvm.org/D86502
Hongtao Yu [Tue, 25 Aug 2020 00:52:47 +0000 (17:52 -0700)]
[CSSPGO] Pseudo probe instrumentation pass
This change introduces a pseudo probe instrumentation pass for block instrumentation. Please refer to https://reviews.llvm.org/D86193 for the whole story.
Given the following LLVM IR:
```
define internal void @foo2(i32 %x, void (i32)* %f) !dbg !4 {
bb0:
%cmp = icmp eq i32 %x, 0
br i1 %cmp, label %bb1, label %bb2
bb1:
br label %bb3
bb2:
br label %bb3
bb3:
ret void
}
```
The instrumented IR will look like below. Note that each llvm.pseudoprobe intrinsic call represents a pseudo probe at a block, of which the first parameter is the GUID of the probe’s owner function and the second parameter is the probe’s ID.
```
define internal void @foo2(i32 %x, void (i32)* %f) !dbg !4 {
bb0:
%cmp = icmp eq i32 %x, 0
call void @llvm.pseudoprobe(i64
837061429793323041, i64 1)
br i1 %cmp, label %bb1, label %bb2
bb1:
call void @llvm.pseudoprobe(i64
837061429793323041, i64 2)
br label %bb3
bb2:
call void @llvm.pseudoprobe(i64
837061429793323041, i64 3)
br label %bb3
bb3:
call void @llvm.pseudoprobe(i64
837061429793323041, i64 4)
ret void
}
```
Reviewed By: wmi
Differential Revision: https://reviews.llvm.org/D86499
Fangrui Song [Mon, 30 Nov 2020 18:16:19 +0000 (10:16 -0800)]
[PowerPC] Delete remnant Darwin code in PPCAsmParser
Continue the work started at D50989.
The code has been long dead since the triple has been removed (D75494).
Reviewed By: nickdesaulniers, void
Differential Revision: https://reviews.llvm.org/D91836
Simon Pilgrim [Mon, 30 Nov 2020 18:10:52 +0000 (18:10 +0000)]
[InstCombine][X86] Add addsub PR46277 test case
Also fix a copy+paste typo in the elts_addsub_v4f32 demanded elts test from the godbolt reference
Kazushi (Jam) Marukawa [Mon, 30 Nov 2020 17:53:28 +0000 (02:53 +0900)]
[VE][NFC] Update comments
Update comments. I forgot to update it previously when I modified code.