Commit Graph

402987 Commits

Author SHA1 Message Date
Michael Jones 9830518082 [libc][obvious] fix strdup being listed twice
strdup was being included even if malloc wasn't and that was causing
a build failure.

Differential Revision: https://reviews.llvm.org/D112641
2021-10-27 11:13:08 -07:00
Douglas Yung fff2c0f0bf Add "REQUIRES: native" to test.
This test was failing on the PS4 bot because the test attempts to link, but the PS4 platform requires an external
linker that is not present, causing the test to fail. This should get the PS4 bot green again.
2021-10-27 11:06:13 -07:00
Nico Weber 6503a68565 [lld/mac] Don't assert when ICFing arm64 code
WordLiteralSection dedupes literals by content.
WordLiteralInputSection::getOffset() used to read a literal at the passed-in
offset and look up this value in the deduping map to find the offset of the
deduped value.

But it's possible that (e.g.) a 16-byte literal's value is accessed 4 bytes in.
To get the offset at that address, we have to get the deduped value at offset 0
and then apply the offset 4 to the result.

(See also WordLiteralSection::finalizeContents() which fills in those maps.)

Only a problem on arm64 because in x86_64 the offset is part of the instruction
instead of a separate ARM64_RELOC_ADDEND relocation. (See bug for more details.)

Fixes PR51999.

Differential Revision: https://reviews.llvm.org/D112584
2021-10-27 14:02:07 -04:00
Alexandre Rames 0a06068ac7 [MLIR] Remove the unused `ArithmeticCastOp`.
This was deprecated as part of a54f4eae0e.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D112638
2021-10-27 10:55:56 -07:00
Sam Clegg 1aeb4c4a43 [lld][WebAssebmly] Convert tests to use disassembly. NFC
Differential Revision: https://reviews.llvm.org/D112590
2021-10-27 10:34:52 -07:00
Kirill Bobyrev 22079c61a8
[clangd] IncludeCleaner: Do not process locations in built-in files
Doing otherwise leads to crashing. Way to reproduce: open "gmock/gmock.h" in
the LLVM source tree.

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D112608
2021-10-27 19:31:43 +02:00
Michael Jones 65bb6593e5 [libc] add strdup implementation
Add an implementation for strdup.

Reviewed By: lntue, sivachandra

Differential Revision: https://reviews.llvm.org/D111584
2021-10-27 10:21:04 -07:00
Michael Jones 7dcdbabb3b [libc] add malloc funcs as external entrypoints
malloc, calloc, realloc, and free are all functions that other libc
functions depend on, but are pulled from external sources, instead of
having an internal implementation. This patch adds a way to include
functions like that as entrypoints in the list of external entrypoints,
and includes the malloc functions using this new path.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D112104
2021-10-27 10:21:01 -07:00
Michael Liao 6c9f207826 [cmake] Surpress cmake warning on that EH requires RTTI. NFC.
- Both LLVM_REQUIRES_RTTI and LLVM_REQUIRES_EH are internal flags that
  individual targets can use to force RTTI/EH. Turning off
  LLVM_REQUIRES_RTTI should honor if that variable is set explicitly for
  an individual target.
2021-10-27 12:55:45 -04:00
Fangrui Song ecc93ed2d7 [ELF] Replace InputBaseSection::{areRelocsRela,firstRelocation,numRelocation} with relSecIdx
For `InputSection` `.foo`, its `InputBaseSection::{areRelocsRela,firstRelocation,numRelocation}` basically
encode the information of `.rel[a].foo`. However, one uint32_t (the relocation section index)
suffices. See the implementation of `relsOrRelas`.

This change decreases sizeof(InputSection) from 184 to 176 on 64-bit Linux.

The maximum resident set size linking a large application (1.2G output) decreases by 0.39%.

Differential Revision: https://reviews.llvm.org/D112513
2021-10-27 09:51:07 -07:00
Roman Lebedev 156f10c840
[IR] `SCEVExpander::generateOverflowCheck()`: short-circuit `umul_with_overflow`-by-one
It's a no-op, no overflow happens ever: https://alive2.llvm.org/ce/z/Zw89rZ

While generally i don't like such hacks,
we have a very good reason to do this: here we are expanding
a run-time correctness check for the vectorization,
and said `umul_with_overflow` will not be optimized out
before we query the cost of the checks we've generated.

Which means, the cost of run-time checks would be artificially inflated,
and after https://reviews.llvm.org/D109368 that will affect
the minimal trip count for which these checks are even evaluated.
And if they aren't even evaluated, then the vectorized code
certainly won't be run.

We could consider doing this in IRBuilder,  but then we'd need to
also teach `CreateExtractValue()` to look into chain of `insertvalue`'s,
and i'm not sure there's precedent for that.

Refs. https://reviews.llvm.org/D109368#3089809
2021-10-27 19:45:55 +03:00
Fangrui Song 35c3f5610c [ELF][X86] Write R_X86_64_TLSDESC addends with -z rel
Similar to D100544 for AArch64.

Reviewed By: arichardson

Differential Revision: https://reviews.llvm.org/D112592
2021-10-27 09:35:30 -07:00
Kazu Hirata 593451bd3c [X86] Remove getSETOpc (NFC)
This function seems to be unused for at least one year.
2021-10-27 09:22:31 -07:00
Kazu Hirata e6b6190ead [X86] Remove NeedsRetpoline in X86AsmPrinter (NFC)
This field seems to be unused for at least one year.
2021-10-27 09:22:29 -07:00
Kazu Hirata cc73310a81 [X86] Remove CallOperand in X86Operand (NFC)
This field seems to be unused for at least one year.
2021-10-27 09:22:27 -07:00
Dmitry Vyukov 910aeed77e sanitizer_common: fix up onprint.cpp test
Commit D112602 ("sanitizer_common: tighten on_print hook test")
changed fopen to open in this test. fopen created the file
if if does not exist, but open does not. This was unnoticed
during local testing because lit is not hermetic and reuses
files from previous runs, but it started failing on bots.
Fix the open call.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D112630
2021-10-27 18:17:15 +02:00
Mikhail Dvorskiy 8f5cb64c71 [pstl] A hot fix for a reduction parallel pattern of OpenMP backend
Reviewed By: nadiasvertex, ldionne

Differential Revision: https://reviews.llvm.org/D112125
2021-10-27 18:52:41 +03:00
Alexey Bataev 64d1617d18 [SLP]Improve/fix reordering of the gathered graph nodes.
Gathered loads/extractelements/extractvalue instructions should be
checked if they can represent a vector reordering node too and their
order should ve taken into account for better graph reordering analysis/
Also, if the gather node has reused scalars, they must be reordered
instead of the scalars themselves.

Differential Revision: https://reviews.llvm.org/D112454
2021-10-27 08:49:13 -07:00
Raphael Isemann 9d7006c4ae [lldb][NFC] Move a declaration in DWARFASTParserClang to its first use. 2021-10-27 17:46:50 +02:00
Djordje Todorovic 40c2bdf6d1 [llvm-locstats] Move the test from D110621 into test/llvm-locstats/ dir 2021-10-27 17:36:19 +02:00
Aaron Ballman 9fcca8b470 Fix consteval crash when transforming 'this' expressions
When reaching the end of a function body, we need to ensure that the
ExitFunctionBodyRAII object is destroyed before we pop the declaration context
for the function. Exiting the function body causes us to handle immediate
invocations, which involves template transformations that need to know the
correct type for this.

This addresses PR48235.
2021-10-27 11:25:07 -04:00
Gabor Marton a8297ed994 [Analyzer][solver] Handle adjustments in constraint assignor remainder
We can reuse the "adjustment" handling logic in the higher level
of the solver by calling `State->assume`.

Differential Revision: https://reviews.llvm.org/D112296
2021-10-27 17:14:34 +02:00
David Sherwood 5d9318638e [NFC][LoopVectorize] Change getStepVector to take a Value* for the StartIdx
This patch changes the definition of getStepVector from:

  Value *getStepVector(Value *Val, int StartIdx, Value *Step, ...

to

  Value *getStepVector(Value *Val, Value *StartIdx, Value *Step, ...

because:

1. it seems inconsistent to pass some values as Value* and some as
   integer, and
2. future work will require the StartIdx to be an expression made up
   of runtime calculations of the VF.

In widenIntOrFpInduction I've changed the code to pass in the
value returned from getRuntimeVF, but the presence of the assert:

  assert(!VF.isScalable() && "scalable vectors not yet supported.");

means that currently this code path is only exercised for fixed-width
VFs and so the patch is still NFC.

Differential revision: https://reviews.llvm.org/D111882
2021-10-27 16:12:38 +01:00
Roman Lebedev f3190dedee
[IR] `IRBuilderBase::CreateAnd()`: short-circuit `x & 0` --> `0`
https://alive2.llvm.org/ce/z/YzPhSb

Refs. https://reviews.llvm.org/D109368#3089809
2021-10-27 18:01:06 +03:00
Roman Lebedev 749581d21f
[IR] `IRBuilderBase::CreateAnd()`: fix short-circuiting for constant on LHS
Refs. https://reviews.llvm.org/D109368#3089809
2021-10-27 18:01:06 +03:00
Roman Lebedev f3df87d57e
[IR] `IRBuilderBase::CreateOr()`: fix short-circuiting for constant on LHS
There is no guarantee that the constant is on RHS here,
we have to handle both cases.

Refs. https://reviews.llvm.org/D109368#3089809
2021-10-27 18:01:06 +03:00
Roman Lebedev ab1dbcecd6
[IR] `IRBuilderBase::CreateSelect()`: if cond is a constant i1, short-circuit
While we could emit such a tautological `select`,
it will stick around until the next instsimplify invocation,
which may happen after we count the cost of this redundant `select`.
Which is precisely what happens with loop vectorization legality checks,
and that artificially increases the cost of said checks,
which is bad.

There is prior art for this in `IRBuilderBase::CreateAnd()`/`IRBuilderBase::CreateOr()`.

Refs. https://reviews.llvm.org/D109368#3089809
2021-10-27 18:01:05 +03:00
Roman Lebedev 5a8a7b3bf8
[NFC] Re-autogenerate check lines in some tests to ease of future update 2021-10-27 18:01:05 +03:00
Gabor Marton 888af47095 [Analyzer][solver] Simplification: reorganize equalities with adjustment
Initiate the reorganization of the equality information during symbol
simplification. E.g., if we bump into `c + 1 == 0` during simplification
then we'd like to express that `c == -1`. It makes sense to do this only
with `SymIntExpr`s.

Reviewed By: steakhal

Differential Revision: https://reviews.llvm.org/D111642
2021-10-27 16:48:55 +02:00
OCHyams 6b1599d7a3 [dexter] Fix failing regression tests
D109833 makes the flags `--builder` and `--binary` mutually exclusive, which
caused some regression tests to fail. Add a new substitution
`%dexter_regression_base` that doesn't include the `--builder`, `--cflags` or
`--ldflags` flags and use that for tests that use the `--binary` flag.

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D112624
2021-10-27 15:39:14 +01:00
Alexey Bataev 9b12975cbf Revert "[SLP]Improve/fix reordering of the gathered graph nodes."
This reverts commit f719b794bc to fix
instability in tests.
2021-10-27 07:31:36 -07:00
AndreyChurbanov a64797b5b8 [OpenMP][NFC] disable test on power because of -mlong-double-80 option 2021-10-27 16:54:44 +03:00
AndreyChurbanov c704b25b44 [OpenMP] libomp: Fix possible NULL dereference.
According to dlsym description, the value of symbol could be NULL,
and there is no error in this case. Thus dlerror will also return NULL in
this case. We need to check the value returned by dlerror before printing it.

Differential Revision: https://reviews.llvm.org/D112174
2021-10-27 16:54:44 +03:00
Nico Weber 9f90347588 fix comment typos to cycle bots 2021-10-27 09:53:08 -04:00
Nico Weber e545e11a9e [gn build] Use LLD as host linker by default on macOS if clang_base_path is set
lld/mac should be stable enough to use it as host linker. I've been
using `use_lld=true` in my local args.gn for many months now and it
works fine (and links much faster than ld64).

Differential Revision: https://reviews.llvm.org/D112622
2021-10-27 09:44:00 -04:00
Nico Weber 99f5f0a2b7 fix comment typos to cycle bots 2021-10-27 09:43:42 -04:00
Nico Weber 0d13c595fc [gn build] Add lldb to default target on Windows
It seems to build fine (even though some tests fail), so might
as well let the bots build it. If it turns out to break a lot,
we can always turn it back off.

Differential Revision: https://reviews.llvm.org/D112620
2021-10-27 09:39:57 -04:00
Jeremy Morse c99fdd456f [DebugInfo][NFC] Initialize a new object field in unittests
Over in e7084ceab3 the InstrRefBasedLDV class grew a MachineRegisterInfo
pointer to lookup register sizes -- however, that field wasn't initialized
in the corresponding unit tests. This patch initializes it!

Fixes a buildbot failure reported on D112006
2021-10-27 14:29:43 +01:00
Kerry McLaughlin f01fafdcd4 [SVE][CodeGen] Fix incorrect legalisation of zero-extended masked loads
PromoteIntRes_MLOAD always sets the extension type to `EXTLOAD`, which
results in a sign-extended load. If the type returned by getExtensionType()
for the load being promoted is something other than `NON_EXTLOAD`, we
should instead pass this to getMaskedLoad() as the extension type.

Reviewed By: CarolineConcatto

Differential Revision: https://reviews.llvm.org/D112320
2021-10-27 14:15:41 +01:00
Dmitry Vyukov eae047afe0 sanitizer_common: tighten on_print hook test
The new tsan runtime does not support arbitrary forms
of recursing into the runtime from hooks.
Disable instrumentation of the hook and use write instead
of fwrite (calls malloc internally).
The new version still recurses (write is intercepted),
but does not fail now (the issue at hand was malloc).

Depends on D112601.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D112602
2021-10-27 15:11:43 +02:00
Dmitry Vyukov f50cee2f4b tsan: switch sync test from EXPECT to CHECK
Gtest's EXPECT calls whole lot of libc functions
(mem*, malloc) even when EXPECT does not fail.
This does not play well with tsan runtime unit tests
b/c e.g. we call some EXPECTs with runtime mutexes locked.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D112601
2021-10-27 15:11:31 +02:00
Alexey Bataev f719b794bc [SLP]Improve/fix reordering of the gathered graph nodes.
Gathered loads/extractelements/extractvalue instructions should be
checked if they can represent a vector reordering node too and their
order should ve taken into account for better graph reordering analysis/
Also, if the gather node has reused scalars, they must be reordered
instead of the scalars themselves.

Differential Revision: https://reviews.llvm.org/D112454
2021-10-27 06:08:40 -07:00
Nico Weber c1f3d08b06 [gn build] add build rule for llvm-locstats
Needed by tests after 30a3652b6a.
2021-10-27 09:07:33 -04:00
Nico Weber c7aaa2efef [clang] Add range accessor for ObjCAtTryStmt catch_stmts and use it
No behavior change.

Differential Revision: https://reviews.llvm.org/D112543
2021-10-27 08:57:05 -04:00
Nico Weber 7c10c9d8e8 [clang] Convert ObjCAtTryStmt to llvm::TrailingObjects
And make it final while here.

No behavior change.

Differential Revision: https://reviews.llvm.org/D112542
2021-10-27 08:57:05 -04:00
Caroline Concatto 1137b7207d [SelectionDAG] Widening the result of INSERT_SUBVECTOR.
Widens the result and first input vector because they have the same size.
The subvector to be inserted is widened in the operand widen function.

Differential Revision: https://reviews.llvm.org/D112187
2021-10-27 13:52:25 +01:00
Nikita Popov fbc0c308d5 [BasicAA] Handle known bits as ranges
BasicAA currently tries to determine that the offset is positive by
checking whether all variable indices are positive based on known
bits, multiplied by a positive scale. However, this is incorrect
if the scale multiplication might overflow. In the modified test
case the original value is positive, but may be negative after a
left shift.

Fix this by converting known bits into a constant range and reusing
the range-based logic, which handles overflow correctly.

Differential Revision: https://reviews.llvm.org/D112611
2021-10-27 14:41:31 +02:00
djtodoro 30a3652b6a [llvm-locstats] Report a warning if overflow was detected by llvm-dwarfdump
Catch that llvm-dwarfdump detected an overflow in statistics.

Differential Revision: https://reviews.llvm.org/D110621
2021-10-27 14:35:29 +02:00
Daniel Kiss 894ddba1c9 Revert "[ARM] __cxa_end_cleanup should be called instead of _UnwindResume."
This reverts commit da1d1a0869.
2021-10-27 14:29:35 +02:00
Jan Svoboda e76a9f1636 [clang][deps] Fix fragile test
This test was failing on GreenDragon.
2021-10-27 14:00:13 +02:00