Jez Ng [Wed, 7 Apr 2021 23:55:45 +0000 (19:55 -0400)]
[lld-macho] Parallelize __LINKEDIT generation
Benchmarking chromium_framework on a 3.2 GHz 16-Core Intel Xeon W Mac Pro:
N Min Max Median Avg Stddev
x 20 4.33 4.42 4.37 4.37 0.
021026299
+ 20 4.12 4.23 4.18 4.175 0.
035318103
Difference at 95.0% confidence
-0.195 +/- 0.0186025
-4.46224% +/- 0.425686%
(Student's t, pooled s = 0.0290644)
Reviewed By: #lld-macho, gkm
Differential Revision: https://reviews.llvm.org/D99998
Stanislav Mekhanoshin [Wed, 7 Apr 2021 17:34:53 +0000 (10:34 -0700)]
Disable use of SCC bit from asm
Differential Revision: https://reviews.llvm.org/D100069
Tony Tye [Tue, 30 Mar 2021 22:38:19 +0000 (22:38 +0000)]
[AMDGPU] Update gfx90a memory model support
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D100070
Stanislav Mekhanoshin [Wed, 7 Apr 2021 19:45:13 +0000 (12:45 -0700)]
[AMDGPU] Split GCNRegBankReassign
Allow pass to work separately with SGPR, VGPR registers or both.
This is NFC now but will be needed to split RA for separate
SGPR and VGPR passes.
Differential Revision: https://reviews.llvm.org/D100063
Florian Hahn [Wed, 7 Apr 2021 21:26:01 +0000 (22:26 +0100)]
[BasicAA] Add another GEP modulo test with shl with odd op.
Sanjay Patel [Wed, 7 Apr 2021 21:19:15 +0000 (17:19 -0400)]
[InstCombine] fold not ops around min/max intrinsics
This is another step towards parity with the existing
cmp+select folds (see D98152).
Sanjay Patel [Wed, 7 Apr 2021 21:14:08 +0000 (17:14 -0400)]
[InstCombine] add test for min/max intrinsic with not ops; NFC
Shafik Yaghmour [Wed, 7 Apr 2021 21:29:12 +0000 (14:29 -0700)]
[LLDB] Clarifying the documentation for variable formatting wrt to qualifiers and adding a test that demonstrates this
When looking up user specified formatters qualifiers are removed from types before matching,
I have added a clarifying example to the document and added an example to a relevant test to demonstrate this behavior.
Differential Revision: https://reviews.llvm.org/D99827
Craig Topper [Wed, 7 Apr 2021 20:46:16 +0000 (13:46 -0700)]
[RISCV] Add a special case to lowerSELECT for select of 2 constants with a SETLT condition.
If the constants have a difference of 1 we can convert one to
the other by adding or subtracting the condition.
We have a DAG combine for this, but it only runs before type
legalization. If the select is introduced later during type
legalization or op legalization we will miss it.
We don't need a specific condition, but some conditions are
harder to materialize than others on RISCV. I know that SETLT
will be a single instruction and it is what is used by the
motivating pattern from signed saturating add/sub.
Differential Revision: https://reviews.llvm.org/D99021
Louis Dionne [Wed, 7 Apr 2021 20:14:00 +0000 (16:14 -0400)]
[libc++abi] Adjust XFAIL for misaligned exception header on ARM
On ARM, the alignment has always been the right one, so this test never
fails.
Jinsong Ji [Wed, 7 Apr 2021 20:08:24 +0000 (20:08 +0000)]
[Driver][test] Test intended target only
6fe7de90b9e4e466a5c2baadafd5f72d3203651d changed GNU toolchain,
and added new RUN line to test expected behavior.
The change is for GNU toolchain only, so this will fail other toolchain,
eg: AIX.
Update the test with `-target` to test GNU tool chain only.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D99901
Vy Nguyen [Wed, 7 Apr 2021 03:40:41 +0000 (23:40 -0400)]
[lld-macho] Make time-trace* options more permissive.
If either `time-trace-granularity` or `time-trace-file` is specified, then don't make users specify `-time-trace`.
It seems silly that I have to type all three options, eg, `-time-trace -time-trace-file=- -time-trace-granularity=...`.
Differential Revision: https://reviews.llvm.org/D100011
Jennifer Yu [Wed, 7 Apr 2021 16:26:14 +0000 (09:26 -0700)]
Fix missing generate capture expression for novariants condition.
Saurabh Jha [Wed, 7 Apr 2021 19:09:50 +0000 (12:09 -0700)]
[clang] Move int <-> float scalar conversion to a separate function
As prelude to this patch https://reviews.llvm.org/D99037, we want to
move the int-float conversion
into a separate function that can be reused by matrix cast
Differential Revision: https://reviews.llvm.org/D100051
Haruki Imai [Wed, 7 Apr 2021 19:17:19 +0000 (19:17 +0000)]
[mlir] Fixed alignment attribute of alloc constant folding.
When allocLikeOp is updated in alloc constant folding,
alighnment attribute was ignored. This patch fixes it.
Signed-off-by: Haruki Imai <imaihal@jp.ibm.com>
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D99882
Paul Robinson [Wed, 7 Apr 2021 17:21:39 +0000 (10:21 -0700)]
Remove .gitignore entries not relevant in the monorepo.
Differential Revision: https://reviews.llvm.org/D100049
Craig Topper [Wed, 7 Apr 2021 19:17:42 +0000 (12:17 -0700)]
[RISCV] Replace 'return ReplaceNode' with 'ReplaceNode; return;' NFC
ReplaceNode is a void function as is the function that we were
doing this in. While this is valid code, it was a bit confusing.
Florian Hahn [Wed, 7 Apr 2021 18:59:17 +0000 (19:59 +0100)]
[BasicAA] Extend test coverage for GEP modulo logic.
Add a few additional test cases which combine multiplies with
powers-of-2, different wrapping flags.
Jonas Hahnfeld [Tue, 30 Mar 2021 16:28:54 +0000 (18:28 +0200)]
[AArch64] Materialize FP constant in code for large code model
When using the large code model with FastISel (for example via
clang -O0 which adds the optnone attribute), FP constants could
still be materialized using adrp + ldr. Unconditionally enable
the existing path for MachO to materialize the constant in code.
For testing, restore literal_pools_float.ll to exercise the constant
pool and add two optnone-functions that return a float and a double,
respectively. Consolidate fpimm.ll and add a new fast-isel-fpimm.ll
to check the code paths taken with FastISel.
Differential Revision: https://reviews.llvm.org/D99607
Arthur Eubanks [Wed, 7 Apr 2021 18:26:18 +0000 (11:26 -0700)]
Revert "[AsmPrinter] Delete dead takeDeletedSymbsForFunction()"
This reverts commit
9583a3f2625818b78c0cf6d473cdedb9f23ad82c.
This wasn't NFC as initially thought. Needed for D99707.
Abhina Sreeskantharajan [Wed, 7 Apr 2021 18:09:21 +0000 (14:09 -0400)]
[Windows] Remove global OF_None flag for Windows in ToolOutputFiles
Since we have created a new OF_TextWithCRLF flag, we no longer need to worry about OF_Text flag turning on CRLF translation. I can remove this workaround I added to globally open all ToolOutputFiles as binary on Windows.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D100034
Aaron Ballman [Wed, 7 Apr 2021 17:59:54 +0000 (13:59 -0400)]
Correct the tablegen logic for MutualExclusions attribute checking.
Just because an attribute is a statement attribute doesn't mean it's
not also a declaration attribute. In Clang, there are not currently any
DeclOrStmtAttr attributes that require mutual exclusion checking, but
downstream clients discovered this issue.
Vy Nguyen [Wed, 7 Apr 2021 05:32:59 +0000 (01:32 -0400)]
[lld-macho][nfc] Minor refactoring + clang-tidy fixes
- use "empty()" instead of "size()"
- refactor the re-export code so it doesn't create a new vector every time.
Differential Revision: https://reviews.llvm.org/D100019
Jordan Rupprecht [Wed, 7 Apr 2021 16:55:20 +0000 (09:55 -0700)]
[lldb][Editline] Fix crash when navigating through empty command history.
An empty history entry can happen by entering the expression evaluator an immediately hitting enter:
```
$ lldb
(lldb) e
Enter expressions, then terminate with an empty line to evaluate:
1: <hit enter>
```
The next time the user enters the expression evaluator, if they hit the up arrow to load the previous expression, lldb crashes. This patch treats empty history sessions as a single expression of zero length, instead of an empty list of expressions.
Fixes http://llvm.org/PR49845.
Differential Revision: https://reviews.llvm.org/D100048
Craig Topper [Wed, 7 Apr 2021 17:14:59 +0000 (10:14 -0700)]
[RISCV] Support vslide1up/down intrinsics for SEW=64 on RV32.
This can't use our normal strategy of splatting the scalar and using
a .vv operation instead of .vx.
Instead this patch bitcasts the vector to the equivalent SEW=32
vector and inserts the scalar parts using two vslide1up/down. We
do that unmasked and apply the mask separately at the end with
a vmerge.
For vslide1up there maybe some other options here like getting
i64 into element 0 and using vslideup.vi with this vector as
vd and the original source as vs1. Masking would still need to
be done afterwards.
That idea doesn't work for vslide1down. We need to slidedown and
then insert a single scalar at vl-1 which we could do with a
vslideup, but that assumes vl > 0 which I don't think we can assume.
The i32 double slide1down implemented here is the best I could come
up with and I just made vslide1up consistent.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D99910
Aaron En Ye Shi [Wed, 7 Apr 2021 17:19:28 +0000 (17:19 +0000)]
[HIP] Fix rocm-detect.hip test path
The ROCm installation directory may be another
directory, llvm/ inside the build directory.
Reviewed By: yaxunl
Differential Revision: https://reviews.llvm.org/D100045
Craig Topper [Wed, 7 Apr 2021 17:03:31 +0000 (10:03 -0700)]
[SelectionDAG] Teach SelectionDAG::FoldConstantArithmetic to handle SPLAT_VECTOR
This allows FoldConstantArithmetic to handle SPLAT_VECTOR in
addition to BUILD_VECTOR. This allows it to support scalable
vectors. I'm also allowing fixed length SPLAT_VECTOR which is
used by some targets, but I'm not familiar enough to write tests
for those targets.
I had to block this function from running on CONCAT_VECTORS to
avoid calling getNode for a CONCAT_VECTORS of 2 scalars.
This can happen because the 2 operand getNode calls this
function for any opcode. Previously we were protected because
CONCAT_VECTORs of BUILD_VECTOR is folded to a larger BUILD_VECTOR
before that call. But it's not always possible to fold a CONCAT_VECTORS
of SPLAT_VECTORs, and we don't even try.
This fixes PR49781 where DAG combine thought constant folding
should be possible, but FoldConstantArithmetic couldn't do it.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D99682
Craig Topper [Wed, 7 Apr 2021 16:44:52 +0000 (09:44 -0700)]
[LoopIdiomRecognize] Minor cleanups to the FFS idiom matching. NFC
-Make sure of the CreateShl/LShr/AShr methods that take a uint64_t
instead of creating a ConstantInt for 1 ourselves.
-Use Builder.getInt1 or ConstantInt::getBool instead of a conditional.
-Pull out repeated calls to getType.
Aart Bik [Tue, 6 Apr 2021 23:46:27 +0000 (16:46 -0700)]
[mlir][sparse] support integral types i32,i16,i8 for *numerical* values
Some sparse matrices operate on integral values (in contrast with the common
f32 and f64 values). This CL expands the compiler and runtime support to deal
with several common type combinations.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D99999
Dimitry Andric [Wed, 7 Apr 2021 16:51:53 +0000 (18:51 +0200)]
Avoid testing for libc++ internal macros after D99834
As D99834 was meant specifically for FreeBSD, which still uses the older
non-trivial std::pair copy constructors, test for `__FreeBSD__` instead
of relying on a macro which is an internal detail of libc++.
Noted by Louis Dionne.
Roman Lebedev [Wed, 7 Apr 2021 16:46:30 +0000 (19:46 +0300)]
[InstCombine] foldAddWithConstant(): don't deal with non-immediate constants
All of the code that handles general constant here (other than the more
restrictive APInt-dealing code) expects that it is an immediate,
because otherwise we won't actually fold the constants, and increase
instruction count. And it isn't obvious why we'd be okay with
increasing the number of constant expressions,
those still will have to be run..
But after
2829094a8e252d04f13aabdf6f416c42a06af695
this could also cause endless combine loops.
So actually properly restrict this code to immediates.
Mark de Wever [Wed, 24 Mar 2021 18:54:40 +0000 (19:54 +0100)]
[libc++] Update contributor documentation.
The document has the following updates:
- Rename 'feature test' to 'feature-test', the latter is the spelling
used in the Standard.
- Add information how an ABI list can be downloaded from Buildkite.
Differential Revision: https://reviews.llvm.org/D99290
Sanjay Patel [Wed, 7 Apr 2021 16:11:23 +0000 (12:11 -0400)]
[InstCombine] avoid infinite loop from partial undef vectors
This fixes the examples from
D99674 and
https://llvm.org/PR49878
The matchers succeed on partial undef/poison vector constants,
but the transform creates a full 'not' (-1) constant, so it
would undo a demanded vector elements change triggered by the
extractelement.
Differential Revision: https://reviews.llvm.org/D100044
Christopher Di Bella [Fri, 2 Apr 2021 18:07:31 +0000 (18:07 +0000)]
[libcxx] adds __cpp_lib_concepts feature-test macro
Also adjusts C++20 status paper to indicate full concepts support.
Depends on D96477, D99817.
Differential Revision: https://reviews.llvm.org/D99805
Christopher Di Bella [Wed, 31 Mar 2021 05:28:25 +0000 (05:28 +0000)]
[libcxx] adds remaining callable concepts
* `std::predicate`
* `std::relation`
* `std::equivalence_relation`
* `std::strict_weak_order`
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Differential Revision: https://reviews.llvm.org/D96477
Jez Ng [Wed, 7 Apr 2021 16:08:14 +0000 (12:08 -0400)]
[lld-macho] Sibling N_SO symbols must have the empty string
We had been giving them a string index of zero, which actually corresponds to a
string with a single space due to {D89639}.
This was far from obvious in the old test because llvm-nm doesn't quote the
symbol names, making the empty string look identical to a string of a single
space. `dsymutil -s` quotes its strings, so I've changed the test accordingly.
Fixes llvm.org/PR48714. Thanks @clayborg for the tips!
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D100003
Jez Ng [Wed, 7 Apr 2021 16:08:12 +0000 (12:08 -0400)]
[lld-macho][nfc] Add test for ARM64 stubs
Reviewed By: #lld-macho, gkm
Differential Revision: https://reviews.llvm.org/D99813
wlei [Wed, 7 Apr 2021 15:38:13 +0000 (08:38 -0700)]
[CSSPGO] Fix incorrect probe distribution factor computation in top-down inliner
We see a regression related to low probe factor(0.01) which prevents some callsites being promoted in ICPPass and later cause the missing inline in CGSCC inliner. The root cause is due to redundant(the second) multiplication of the probe factor and this change try to fix it.
`Sum` does multiply a factor right after findCallSamples but later when using as the parameter in setProbeDistributionFactor, it multiplies one again.
This change could get ~2% perf back on mcf benchmark. In mcf, previously the corresponding factor is 1 and it's the recent feature introducing the <1 factor then trigger this bug.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D99787
Simon Pilgrim [Wed, 7 Apr 2021 15:43:36 +0000 (16:43 +0100)]
[X86][AVX] Add HADD lane crossing test
This used to work before rG77d625f8d8aa, but we now merge the shuffles across the fadd resulting in a hadd that requires a lane crossing post shuffle, which we don't permit on AVX1 targets
Nicolas Vasilache [Wed, 7 Apr 2021 15:21:40 +0000 (15:21 +0000)]
[mlir] Export python-related .cmake files
This allows downstream projects to build python extensions using the same macros as MLIR.
Differential Revision: https://reviews.llvm.org/D100040
Abhina Sreeskantharajan [Wed, 7 Apr 2021 15:21:33 +0000 (11:21 -0400)]
[SystemZ][z/OS][TableGen] TableGen files should be text
This patch sets tablegen files as text. It should have no effect on Windows after this patch landed https://reviews.llvm.org/rG82b3e28e836d2f5c8cfd6e1047b93c088522365a.
Reviewed By: anirudhp
Differential Revision: https://reviews.llvm.org/D100036
Jacques Pienaar [Wed, 7 Apr 2021 15:21:15 +0000 (08:21 -0700)]
[mlir,shape] Update min/max op description
Sander de Smalen [Wed, 17 Mar 2021 21:46:32 +0000 (21:46 +0000)]
[SVE] Remove checks for warnings in scalable-vector tests.
After D98856 these tests will by default break (fatal_error) if any of
the wrong interfaces are used, so there's no longer a need to have a
RUN line that checks for a warning message emitted by the compiler.
Sam Clegg [Tue, 6 Apr 2021 15:06:18 +0000 (08:06 -0700)]
[WebAssembly] Improve error messages regarding missing indirect function table. NFC
Use report_fatal_error here since this is an internal error, and not
something the user can/should be trying to fix.
Also distinguish between the symbol being missing and the symbol having
the wrong type.
We have a failure internally where the symbol is missing. Currently
trying to reduce the test case to something we can attach to an llvm
bug.
Differential Revision: https://reviews.llvm.org/D99960
Sebastian Neubauer [Thu, 1 Apr 2021 12:50:59 +0000 (14:50 +0200)]
[AMDGPU] Update SGPRSpillVGPRCSR name. NFC
The struct is used for both, callee and caller-save registers now.
The frame index is not set for entrypoints, as we do not need to save
the registers then.
Update the struct name to reflect that.
Differential Revision: https://reviews.llvm.org/D99722
Jingu Kang [Wed, 7 Apr 2021 13:22:32 +0000 (14:22 +0100)]
[NPM] Fix typo inisLTOPreLink for loop rotate
Differential Revision: https://reviews.llvm.org/D100033
Nico Weber [Wed, 7 Apr 2021 13:42:11 +0000 (09:42 -0400)]
Revert "[clang] Speedup line offset mapping computation"
This reverts commit
6951b72334bbe4c189c71751edc1e361d7b5632c.
Breaks several bots, see comments on https://reviews.llvm.org/D99409
Simon Pilgrim [Wed, 7 Apr 2021 13:07:35 +0000 (14:07 +0100)]
[X86] Improve optimizeCompareInstr for signed comparisons after AND/OR/XOR instructions
Extend D94856 to handle 'and', 'or' and 'xor' instructions as well
We still fail on many i8/i16 cases as the test and the logic-op are performed on different widths
Alexey Bataev [Tue, 6 Apr 2021 12:59:03 +0000 (05:59 -0700)]
[SLP]Avoid multiple attempts to vectorize CmpInsts.
No need to lookup through and/or try to vectorize operands of the
CmpInst instructions during attempts to find/vectorize min/max
reductions. Compiler implements postanalysis of the CmpInsts so we can
skip extra attempts in tryToVectorizeHorReductionOrInstOperands and save
compile time.
Differential Revision: https://reviews.llvm.org/D99950
Andrzej Warzynski [Wed, 7 Apr 2021 13:10:35 +0000 (13:10 +0000)]
[flang][driver] Fix `-fdebug-dump-provenance`
The -fdebug-dump-provenance flag is meant to be used with
needProvenanceRangeToCharBlockMappings set to true. This way, extra
mapping is generated that allows e.g. IDEs to retrieve symbol's scope
(offset into cooked character stream) based on symbol's source code
location. This patch makes sure that this option is set when using
-fdebug-dump-provenance.
With this patch, the implementation of -fdebug-dump-provenance in
`flang-new -fc1` becomes consistent with `f18`. The corresponding LIT
test is updated so that it can be shared with `f18`. I refined it a bit
so that:
* it becomes a frontend-only test
* it's stricter about the expected output
Differential Revision: https://reviews.llvm.org/D98847
Jay Foad [Wed, 7 Apr 2021 13:03:17 +0000 (14:03 +0100)]
[AMDGPU] SIFoldOperands: don't dump extra '\n' after MachineInstr. NFC.
Andrzej Warzynski [Wed, 7 Apr 2021 11:42:37 +0000 (11:42 +0000)]
[flang][driver] Add support for `-cpp/-nocpp`
This patch adds support for the `-cpp` and `-nocpp` flags. The
implemented semantics match f18 (i.e. the "throwaway" driver), but are
different to gfortran. In Flang the preprocessor is always run. Instead,
`-cpp/-nocpp` are used to control whether predefined and command-line
preprocessor macro definitions are enabled or not. In practice this is
sufficient to model gfortran`s `-cpp/-nocpp`.
In the absence of `-cpp/-nocpp`, the driver will use the extension of
the input file to decide whether to include the standard macro
predefinitions. gfortran's documentation [1] was used to decide which
file extension to use for this.
The logic mentioned above was added in FrontendAction::BeginSourceFile.
That's relatively late in the driver set-up, but this roughly where the
name of the input file becomes available. The logic for deciding between
fixed and free form works in a similar way and was also moved to
FrontendAction::BeginSourceFile for consistency (and to reduce
code-duplication).
The `-cpp/-nocpp` flags are respected also when the input is read from
stdin. This is different to:
* gfortran (behaves as if `-cpp` was used)
* f18 (behaves as if `-nocpp` was used)
Starting with this patch, file extensions are significant and some test
files had to be renamed to reflect that. Where possible, preprocessor
tests were updated so that they can be shared between `f18` and
`flang-new`. This was implemented on top of adding new test for
`-cpp/-nocpp`.
[1] https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D99292
oToToT [Wed, 7 Apr 2021 12:58:48 +0000 (20:58 +0800)]
[clang] Check AuxTarget exists when creating target in CompilerInstance
D97493 separate target creation out to a single function
`CompilerInstance::createTarget`. However, it would overwrite AuxTarget
even if it has been set.
As @kadircet recommended in D98128, this patch check the existence of
AuxTarget and not overwrite it when it has been set.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D100024
Sanjay Patel [Wed, 7 Apr 2021 12:12:38 +0000 (08:12 -0400)]
[InstCombine] move abs transform to helper function; NFC
The swap of the operands can affect later transforms that
are expecting a constant as operand 1. I don't think we
can trigger a bug with the current code, but I hit that
problem while drafting a new transform for min/max intrinsics.
Sanjay Patel [Tue, 6 Apr 2021 20:31:25 +0000 (16:31 -0400)]
[InstCombine] add tests for not-of-min/max; NFC
Matthias Springer [Wed, 7 Apr 2021 12:11:55 +0000 (21:11 +0900)]
[mlir] Add "mask" operand to vector.transfer_read/write.
Also factors out out-of-bounds mask generation from vector.transfer_read/write into a new MaterializeTransferMask pattern.
Differential Revision: https://reviews.llvm.org/D100001
Simon Pilgrim [Wed, 7 Apr 2021 12:27:41 +0000 (13:27 +0100)]
[X86] Add AND/OR/XOR signed-comparison overflow test cases for PR48768
D94856 covered the BMI cases where we had existing tests, this adds missing AND/OR/XOR test cases
Florian Hahn [Wed, 7 Apr 2021 12:01:17 +0000 (13:01 +0100)]
[Clang] Extend test coverage for -f[no-]finite-loops options.
Extend test coverage by checking various standard versions with
-f[no-]finite-loops. Suggested as part of D96418.
serge-sans-paille [Thu, 1 Apr 2021 20:18:55 +0000 (22:18 +0200)]
[clang] Speedup line offset mapping computation
Clang spends a decent amount of time in the LineOffsetMapping::get(...)
function. This function used to be vectorized (through SSE2) then the
optimization got dropped because the sequential version was on-par performance
wise.
This provides an optimization of the sequential version that works on a word at
a time, using (documented) bithacks to provide a portable vectorization.
When preprocessing the sqlite amalgamation, this yields a sweet 3% speedup.
Differential Revision: https://reviews.llvm.org/D99409
Balazs Benics [Wed, 7 Apr 2021 11:42:29 +0000 (13:42 +0200)]
[analyzer][NFC] Add tests for extents
If we allocate memory, the extent of the MemRegion will be the symbolic
value of the size parameter. This way, if that symbol gets constrained,
the extent will be also constrained.
This test demonstrates that the extent is indeed the same symbol.
Reviewed By: NoQ
Differential Revision: https://reviews.llvm.org/D99959
Simon Pilgrim [Wed, 7 Apr 2021 11:07:10 +0000 (12:07 +0100)]
[X86] Improve optimizeCompareInstr for signed comparisons after BZHI instructions
Extend D94856 to handle 'bzhi' instructions as well
Valeriy Savchenko [Tue, 30 Mar 2021 16:06:37 +0000 (19:06 +0300)]
[-Wcompletion-handler] Don't recognize init methods as conventional
rdar://
75704162
Differential Revision: https://reviews.llvm.org/D99601
Yevgeny Rouban [Wed, 7 Apr 2021 10:45:05 +0000 (17:45 +0700)]
[Statepoint Lowering] Allow other than N byte sized types in deopt bundle
I do not see any bit-width restriction from the point of the
LLVM Lang Ref - Operand Bundles on the types of the deopt bundle
operands. Statepoint Lowering seems to be able to work with any
types.
This patch relaxes the two related assertions and adds a new test
for this change.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D100006
Valeriy Savchenko [Tue, 23 Mar 2021 15:48:58 +0000 (18:48 +0300)]
[analyzer] Fix body farm for Obj-C++ properties
When property is declared in a superclass (or in a protocol),
it still can be of CXXRecord type and Sema could've already
generated a body for us. This patch joins two branches and
two ways of acquiring IVar in order to reuse the existing code.
And prevent us from generating l-value to r-value casts for
C++ types.
rdar://
67416721
Differential Revision: https://reviews.llvm.org/D99194
Simon Pilgrim [Wed, 7 Apr 2021 10:20:55 +0000 (11:20 +0100)]
[X86] Add BZHI test case for PR48768
D94856 covered the BMI cases where we had existing tests, this adds a missing BZHI test case
crr0004 [Wed, 7 Apr 2021 10:31:41 +0000 (12:31 +0200)]
Fix crash when an invalid URI is parsed and error handling is attempted
When you pass in a payload with an invalid URI in a build with assertions enabled, it will crash.
Consuming the error from the failed URI parse prevents the error.
The crash is caused by the [llvm::expected](https://llvm.org/doxygen/classllvm_1_1Expected.html) having protection around trying to deconstruct without consuming the error first.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D99872
Kirill Bobyrev [Wed, 7 Apr 2021 09:23:10 +0000 (11:23 +0200)]
[CMake] try creating symlink first on windows
//-E create_symlink// is available on windows since CMake 3.13 (LLVM now uses 3.13.4)
It may needs administrator privileges or enabled developer mode (Windows 10)
See https://cmake.org/cmake/help/latest/release/3.13.html
Reviewed By: kbobyrev
Differential Revision: https://reviews.llvm.org/D99170
Utkarsh Saxena [Tue, 6 Apr 2021 09:55:55 +0000 (11:55 +0200)]
[clang][Syntax] Handle invalid source range in expandedTokens.
Differential Revision: https://reviews.llvm.org/D99934
Sven van Haastregt [Wed, 7 Apr 2021 09:16:41 +0000 (10:16 +0100)]
[OpenCL] Add as_size/ptrdiff/intptr/uintptr_t operators
size_t and friends are built-in scalar data types and s6.4.4.2 of the
OpenCL C Specification says the as_type() operator must be available
for these data types.
Differential Revision: https://reviews.llvm.org/D98959
Stefan Gränitz [Wed, 7 Apr 2021 09:11:27 +0000 (11:11 +0200)]
[Orc][examples] Add missing FileCheck for lit test and polish output
Roman Lebedev [Wed, 7 Apr 2021 08:04:57 +0000 (11:04 +0300)]
Reland [InstCombine] Fold `((X - Y) - Z)` to `X - (Y + Z)` (PR49858)
This reverts commit
a547b4e26b311e417cd51100e379693f51a3f448,
relanding commit
31d219d2997fed1b7dc97e0adf170d5aaf65883e,
which was reverted because there was a conflicting inverse transform,
which was causing an endless combine loop, which has now been adjusted.
Original commit message:
https://alive2.llvm.org/ce/z/67w-wQ
We prefer `add`s over `sub`, and this particular xform
allows further folds to happen:
Fixes https://bugs.llvm.org/show_bug.cgi?id=49858
Roman Lebedev [Wed, 7 Apr 2021 08:50:14 +0000 (11:50 +0300)]
[InstCombine] Restrict "C-(X+C2) --> (C-C2)-X" fold to immediate constants
I.e., if any/all of the consants is an expression, don't do it.
Since those constants won't reduce into an immediate,
but would be left as an constant expression, they could cause
endless combine loops after
31d219d2997fed1b7dc97e0adf170d5aaf65883e
added an inverse transformation.
Roman Lebedev [Wed, 7 Apr 2021 08:50:06 +0000 (11:50 +0300)]
[NFC][InstCombine] Add sub-of-sub tests with constant expressions
These would cause endless combine loop after
31d219d2997fed1b7dc97e0adf170d5aaf65883e.
Thomas Preud'homme [Mon, 5 Apr 2021 10:28:35 +0000 (11:28 +0100)]
[PowerPC, test] Fix use of undef FileCheck var
LLVM test CodeGen/PowerPC/ppc-disable-non-volatile-cr.ll tries to check
for the absence of a sequence of instructions with several CHECK-NOT
with one of those directives using a variable defined in another.
However CHECK-NOT are checked independently so that is using a variable
defined in a pattern that should not occur in the input.
This commit changes occurence of the variable for the regex used in its
definition, thereby making each CHECK-NOT independent.
Reviewed By: NeHuang, nemanjai
Differential Revision: https://reviews.llvm.org/D99880
Thomas Preud'homme [Sun, 28 Mar 2021 00:03:37 +0000 (00:03 +0000)]
[clang, test] Fix use of undef FileCheck var
Clang test CodeGen/libcalls.c contains CHECK-NOT directives using a
variable defined in a CHECK directive with a different prefix never
enabled together, therefore causing the variable to be undefined in that
CHECK-NOT.
The intent of the test is to check that some declaration do not have the
same attribute as when compiling the test without -fmath-errno. This
commits instead changes all CHECK-NOT to CHECK directive, checking that
they all use the same attribute. It also adds an extra CHECK for that
prefix to check the expected attributes these functions should have when
compiling with -fmath-errno.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D99898
Thomas Preud'homme [Sun, 28 Mar 2021 00:03:37 +0000 (00:03 +0000)]
[Coroutines, test] Fix use of var defined in CHECK-NOT
LLVM test Transforms/Coroutine/coro-split-sink-lifetime-O2.ll tries to
check for the absence of a sequence of instructions with several
CHECK-NOT with one of those directives using a variable defined in
another. However CHECK-NOT are checked independently so that is using a
variable defined in a pattern that should not occur in the input.
This commit simplifies the CHECK-NOT block to only check for the
presence of any lifetime start marker since that is effectively what
the test was testing at the moment.
Reviewed By: junparser
Differential Revision: https://reviews.llvm.org/D99856
Roman Lebedev [Wed, 7 Apr 2021 07:29:18 +0000 (10:29 +0300)]
[CGCall] Annotate `this` argument with alignment
As it is being noted in D99249, lack of alignment information on `this`
has been preventing LICM from happening.
For some time now, lack of alignment attribute does *not* imply
natural alignment, but an alignment of `1`.
Also, we used to treat dereferenceable as implying alignment,
but we no longer do, so it's a bugfix.
Differential Revision: https://reviews.llvm.org/D99790
Qiu Chaofan [Wed, 7 Apr 2021 07:55:52 +0000 (15:55 +0800)]
[PowerPC] Fix use check of swap-reduction
This will fix swap-reduction in DAGISel for cases where COPY_TO_REGCLASS
has multiple uses.
Stefan Gränitz [Wed, 7 Apr 2021 07:44:18 +0000 (09:44 +0200)]
[Orc][examples] Add lit ToolSubst for LLJITWithRemoteDebugging example
The test case added in
258f055ed936 was lacking two important details for the test infrastructure.
ae217bf1f327 added the executable to LLVM_TEST_DEPENDS in CMake to make sure the exectubale gets built before we run the test suite. This patch adds a ToolSubst for the executable in LIT, which replaces the tool invokation in the RUN line with an absolute path. It makes sure we don't run accidentally run some other tool from the user's PATH. The test works without it in case LLVM's main binary directory happens to be the working directory (which is default apparently). Configurations that don't build the examples ignore failures for this ToolSubst (and won't run the test).
Reviewed By: echristo
Differential Revision: https://reviews.llvm.org/D99931
LemonBoy [Tue, 6 Apr 2021 18:40:15 +0000 (20:40 +0200)]
[X86] Initialize TargetOptions::StackProtectorGuardOffset member to its default value
D88631 introduced a set of knobs to tweak how the stack protector is codegen'd for x86 targets, including the offset from the base register where the stack cookie is located. The `StackProtectorGuardOffset` field in `TargetOptions` was left uninitialized instead of being reset to its neutral value -1, making it possible to emit nonsensical code if the frontend doesn't change the field value at all before feeding the `TargetOptions` to the target machine initializer.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D99952
Max Kazantsev [Wed, 7 Apr 2021 06:14:53 +0000 (13:14 +0700)]
[SCEV] Fix false-positive recognition of simple recurrences. PR49856
A value from reachable block may come to a Phi node as its input from
unreachable block. This may confuse matchSimpleRecurrence which
has no access to DomTree and can falsely recognize something as a recurrency
because of this effect, as the attached test shows.
Patch `ae7b1e` deals with half of this problem, but it only accounts from
the case when an unreachable instruction comes to Phi as an input.
This patch provides a generalization by checking that no Phi block's
predecessor is unreachable (no matter what the input is).
Differential Revision: https://reviews.llvm.org/D99929
Reviewed By: reames
Petr Hosek [Wed, 7 Apr 2021 06:22:08 +0000 (23:22 -0700)]
Revert "[NFC][Clang] Speculative fix for builtins-ppc-quadword-noi128.c"
This reverts commit
849d3729433e05e6d89892c1814fa07ed3ec18e2 which
depends on
31d219d2997fed1b7dc97e0adf170d5aaf65883e that was reverted.
Christopher Di Bella [Fri, 2 Apr 2021 21:33:39 +0000 (21:33 +0000)]
[libcxx] fixes `common_reference` requirement for `swappable_with`
LWG3175 identifies that the `common_reference` requirement for
`swappable_with` is over-constraining and doesn't need to concern itself
with cv- or reference qualifiers.
Differential Revision: https://reviews.llvm.org/D99817
Petr Hosek [Wed, 7 Apr 2021 05:30:28 +0000 (22:30 -0700)]
Revert "[InstCombine] Fold `((X - Y) - Z)` to `X - (Y + Z)` (PR49858)"
This reverts commit
31d219d2997fed1b7dc97e0adf170d5aaf65883e which
causes an infinite loop when compiling the XRay runtime.
Jacques Pienaar [Wed, 7 Apr 2021 03:22:42 +0000 (20:22 -0700)]
[mlir,shape] Add max/min folder for simple case
When both arguments are the same for these ops, propagate this argument.
Jonas Devlieghere [Wed, 7 Apr 2021 03:15:40 +0000 (20:15 -0700)]
[dsymutil] Stop emulating dsymutil-classic CIE caching behavior
Stop emulating dsymutil-classic which only cached the last used CIE for
reuse.
Jonas Devlieghere [Wed, 7 Apr 2021 02:50:15 +0000 (19:50 -0700)]
[dsymutil] Don't keep old abbreviations
Don't keep the old abbreviations around. This code existed for
compatibility with dsymutil-classic.
Jonas Devlieghere [Wed, 7 Apr 2021 00:23:51 +0000 (17:23 -0700)]
[dsymutil] Don't emit .debug_pubnames and .debug_pubtypes
Consider the .debug_pubnames and .debug_pubtypes their own kind of
accelerator and stop emitting them together with the Apple-style
accelerator tables. The only reason we were still emitting both was for
(byte-for-byte) compatibility with dsymutil-classic.
- This patch adds a new accelerator table kind "Pub" which can be
specified with --accelerator=Pub.
- This patch removes the ability to emit both pubnames/types and apple
style accelerator tables. I don't think anyone is relying on that but
it's worth pointing out.
- This patch removes the --minimize option and makes this behavior the
default. Specifying the flag will result in a warning but won't abort
the program.
Differential revision: https://reviews.llvm.org/D99907
Alex Orlov [Wed, 7 Apr 2021 01:37:46 +0000 (05:37 +0400)]
Removed redundant code.
Yevgeny Rouban [Wed, 7 Apr 2021 01:34:30 +0000 (08:34 +0700)]
[NewPM] Set verify-cfg-preserved=1 by default for debug builds
Weverything [Wed, 7 Apr 2021 00:28:52 +0000 (17:28 -0700)]
Add missing CHECK lines in test
Jacques Pienaar [Wed, 7 Apr 2021 00:58:12 +0000 (17:58 -0700)]
[shape] Add min and max ops
These are element-wise operations that operates on shapes with equal ranks.
Also add missing printer/parser for join operator.
Differential Revision: https://reviews.llvm.org/D99986
Yaxun (Sam) Liu [Wed, 7 Apr 2021 00:32:16 +0000 (20:32 -0400)]
Minor fix for test hip-code-object-version.hip
Changed the order of checking of v2 and v3.
Change-Id: Ifea8197b398afdfb0aa1bd40140cda30f00f0c17
Yaxun (Sam) Liu [Tue, 27 Oct 2020 18:10:02 +0000 (14:10 -0400)]
[HIP] Change to code object v4
Change to code object v4 by default to match ROCm 4.1.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D99235
Craig Topper [Tue, 6 Apr 2021 23:48:07 +0000 (16:48 -0700)]
[RISCV] Add an assertion to the ReplaceNodeResults handling of bitcasts to make sure the VT is always a scalar integer.
Nicolás Alvarez [Tue, 6 Apr 2021 22:15:04 +0000 (00:15 +0200)]
[docs] Fix doxygen comments wrongly attached to the llvm namespace
Looking at the Doxygen-generated documentation for the llvm namespace
currently shows all sorts of random comments from different parts of the
codebase. These are mostly caused by:
- File doc comments that aren't marked with \file, so they're attached to
the next declaration, which is usually "namespace llvm {".
- Class doc comments placed before the namespace rather than before the
class.
- Code comments before the namespace that (in my opinion) shouldn't be
extracted by doxygen at all.
This commit fixes these comments. The generated doxygen documentation now
has proper docs for several classes and files, and the docs for the llvm
and llvm::detail namespaces are now empty.
Reviewed By: thakis, mizvekov
Differential Revision: https://reviews.llvm.org/D96736
Peter Steinfeld [Tue, 6 Apr 2021 16:25:35 +0000 (09:25 -0700)]
[flang] Improve constant folding for type parameter inquiries
We were not folding type parameter inquiries for the form 'var%typeParam'
where 'typeParam' was a KIND or LEN type parameter of a derived type and 'var'
was a designator of the derived type. I fixed this by adding code to the
function 'FoldOperation()' for 'TypeParamInquiry's to handle this case. I also
cleaned up the code for the case where there is no designator.
In order to make the error messages correctly refer to both the points of
declaration and instantiation, I needed to add an argument to the function
'InstantiateIntrinsicType()' for the location of the instantiation.
I also changed the formatting of 'TypeParamInquiry' to correctly format this
case. I also added tests for both KIND and LEN type parameter inquiries in
resolve104.f90.
Making these changes revealed an error in resolve89.f90 and caused one of the
error messages in assign04.f90 to be different.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D99892
Craig Topper [Tue, 6 Apr 2021 21:57:01 +0000 (14:57 -0700)]
[RISCV] Don't custom type legalize fixed vector to scalar integer bitcasts if the fixed vector type isn't legal.
We encountered a hang in our internal code base. I'm having trouble
creating a test case because the test that hit it was testing some
code that is not upstream.
Hansang Bae [Thu, 25 Mar 2021 00:12:00 +0000 (19:12 -0500)]
[OpenMP] Define omp_is_initial_device() variants in omp.h
omp_is_initial_device() is marked as a built-in function in the current
compiler, and user code guarded by this call may be optimized away,
resulting in undesired behavior in some cases. This patch provides a
possible fix for such cases by defining the routine as a variant
function and removing it from builtin list.
Differential Revision: https://reviews.llvm.org/D99447
Jez Ng [Tue, 6 Apr 2021 21:52:30 +0000 (17:52 -0400)]
[lld-macho] Symbol::value should always be uint64_t
D98837 migrated a bunch of `value`s to uint64_t, but missed these.