Commit Graph

395825 Commits

Author SHA1 Message Date
Andrzej Warzynski 55a9615599 [flang][driver] Refactor boolean options
For boolean options, e.g. `-fxor-operator`/`-fno-xor-operator`, we ought
to be using TableGen multi-classes. This way, we only have to write one
definition to have both forms auto-generated. This patch refactors all
of Flang's boolean options to use two new multi-classes:
`OptInFC1FFOption` and `OptOutFC1FFOption`. These multi-classes are
based on `OptInFFOption`/`OptOutFFOption`, respectively. I've also
simplified the processing of the updated options in
CompilerInvocation.cpp.

With the new approach, "empty" help text (i.e. no `HelpText`) is now
replaced with an empty string (i.e. HelpText<"">). When running
flang-new --help, that's considered as non-empty help messages, which is
then printed (that's controlled by `printHelp` from
llvm/lib/Option/OptTable.cpp). This means that with this patch,
flang-new --help will start printing e.g. -fno-backslash, even though
there is no actual help text to print for this option (apart from the
empty string ""). Tests are updated accordingly.

Note that with this patch, both `-fxor-operator` and `-fno-xor-operator`
(and other boolean options refactored here) remain available in
`flang-new` and `flang-new -fc1`. In this respect, nothing changes. In a
forthcoming patch, I will refine this so that `flang-new -fc1` only
accepts `-ffoo` (`OptInFC1FFOption`) or `-fno-foo` (`OptOutCC1FFOption`).

For clarity, `OptInFFOption`/`OptOutFFOption` are renamed as
`OptInCC1FFOption`/`OptOutCC1FFOption`, respectively. Otherwise, this is
an NFC from Clang's perspective.

Differential Revision: https://reviews.llvm.org/D105881
2021-08-05 10:20:47 +00:00
Sven van Haastregt 92b00ffe0f [OpenCL] Reduce duplicate defs by using multiclasses; NFC
Builtin definitions with pointer arguments were duplicated to provide
overloads differing in the pointer argument's address space.

Reduce this duplication by capturing the definitions in multiclasses.
This still results in the same number of builtins in the generated
tables, but the description is more concise now.

Differential Revision: https://reviews.llvm.org/D107151
2021-08-05 11:06:33 +01:00
Neal Sidhwaney 55fd6f292f Revert "D106035: Remove conditional compilation for WCHAR support in libedit"
This reverts commit 7529f0e3e1.
2021-08-05 02:55:10 -07:00
Jay Foad 9bd78932c7 [AMDGPU] Generate checks for ctlz_zero_undef/cttz_zero_undef 2021-08-05 10:38:06 +01:00
Oliver Stannard e345b45bf1 Mark tests as requiring AMDGPU target 2021-08-05 10:02:51 +01:00
Fraser Cormack 0b8471e91b [SelectionDAG] Correctly determine the VECREDUCE_SEQ_FMUL action
The LegalizeAction for this node should follow the logic for
`VECREDUCE_SEQ_FADD` and be determined using the vector operand's type.

here isn't an in-tree target that makes use of this, but I think it's safe to
say this is how it should behave, should a target want to customize the action
for this node.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D107478
2021-08-05 09:42:33 +01:00
Lang Hames 13c8ec44e6 [llvm-jitlink] Don't try to guess the ORC runtime path.
ORC-runtime regression tests will now explicitly specify the runtime path.
2021-08-05 18:46:34 +10:00
Jay Foad e790b2b744 [AMDGPU] Make more use of getHiHalf64 and split64BitValue. NFCI. 2021-08-05 09:36:13 +01:00
Anshil Gandhi 39dac1f7f6 [clang] Add clang builtins support for gfx90a
Implement target builtins for gfx90a including fadd64, fadd32, add2h,
max and min on various global, flat and ds address spaces for which
intrinsics are implemented.

Differential Revision: https://reviews.llvm.org/D106909
2021-08-05 02:08:06 -06:00
Neal Sidhwaney 7529f0e3e1 D106035: Remove conditional compilation for WCHAR support in libedit
This change moves to using narrow character types and libedit APIs in
Editline, because those are the same types that the rest of LLVM/LLDB
uses, and it's generally considered better practice to use UTF-8
encoded in char than it is to use wider characters. However, for
character input, the change leaves in using a wchar to enable input of
multi-byte characters.

Differential Revision: https://reviews.llvm.org/D106035
2021-08-05 00:29:54 -07:00
Martin Storsjö 46020f6f0c [llvm-rc] Allow specifying language with a leading 0x prefix
This option is always interpreted strictly as a hexadecimal string,
even if it has no prefix that indicates the number format, hence
the existing call to StringRef::getAsInteger(16, ...).

StringRef::getAsInteger(0, ...) consumes a leading "0x" prefix is
present, but when the radix is specified, the radix shouldn't
be included.

Both MS rc.exe and GNU windres accept the language with that
prefix.

Also allow specifying the codepage to llvm-windres with a different
radix, as GNU windres allows that (but MS rc.exe doesn't).

This fixes https://llvm.org/PR51295.

Differential Revision: https://reviews.llvm.org/D107263
2021-08-05 10:19:55 +03:00
Michał Górny 39fa96a490 [llvm] [lit] Fix inconsistent test order in shtest-keyword-parse-errors
Remove test times when running shtest-keyword-parse-errors test,
in order to prevent the previous executions from impacting subtest
order and therefore causing FileCheck to fail.

Differential Revision: https://reviews.llvm.org/D107427
2021-08-05 09:16:37 +02:00
Igor Kudrin 2c14798ead [ARM][llvm-objdump] Annotate PC-relative memory operands of VLDR instructions
This extends D105979 and adds support for VLDR instructions.

Differential Revision: https://reviews.llvm.org/D105980
2021-08-05 14:11:11 +07:00
Igor Kudrin ddbe812bcc [ARM][llvm-objdump] Annotate PC-relative memory operands
This implements `MCInstrAnalysis::evaluateMemoryOperandAddress()` for
Arm so that the disassembler can print the target address of memory
operands that use PC+immediate addressing.

Differential Revision: https://reviews.llvm.org/D105979
2021-08-05 14:11:11 +07:00
Fangrui Song 00809c8889 [ELF] Apply version script patterns to non-default version symbols
Currently version script patterns are ignored for .symver produced
non-default version (single @) symbols. This makes such symbols
not localizable by `local:`, e.g.

```
.symver foo3_v1,foo3@v1
.globl foo_v1
foo3_v1:

ld.lld --version-script=a.ver -shared a.o
```

This patch adds the support:

* Move `config->versionDefinitions[VER_NDX_LOCAL].patterns` to `config->versionDefinitions[versionId].localPatterns`
* Rename `config->versionDefinitions[versionId].patterns` to `config->versionDefinitions[versionId].nonLocalPatterns`
* Allow `findAllByVersion` to find non-default version symbols when `includeNonDefault` is true. (Note: `symtab` keys do not have `@@`)
* Make each pattern check both the unversioned `pat.name` and the versioned `${pat.name}@${v.name}`
* `localPatterns` can localize `${pat.name}@${v.name}`. `nonLocalPatterns` can prevent localization by assigning `verdefIndex` (before `parseSymbolVersion`).

---

If a user notices new `undefined symbol` errors with a version script containing
`local: *;`, the issue is likely due to a missing `global:` pattern.

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D107234
2021-08-04 23:52:56 -07:00
Fangrui Song a533eb7423 Revert "[ELF] Apply version script patterns to non-default version symbols"
This reverts commit 7ed22a6fa9.

buf is not cleared so the commit misses some cases.
2021-08-04 23:52:55 -07:00
eopXD 26aa1bbe97 [NFCI] [LoopIdiom] Let processLoopStridedStore take StoreSize as SCEV instead of unsigned
Letting it take SCEV allows further modification on the function to optimize
if the StoreSize / Stride is runtime determined.

This is a preceeding of D107353.
The big picture is to let LoopIdiom deal with runtime-determined sizes.

Reviewed By: Whitney, lebedev.ri

Differential Revision: https://reviews.llvm.org/D104595
2021-08-05 13:21:48 +08:00
Heejin Ahn 9c3345ad10 [WebAssembly] Cleanup Emscripten SjLj tests
- Remove a redundant test: there were `longjmp_only` and `only_longjmp`,
  which do the same thing
- Add `CHECK-LABEL` lines for function names

Reviewed By: tlively

Differential Revision: https://reviews.llvm.org/D107511
2021-08-04 21:16:08 -07:00
Heejin Ahn aa0b0fbbe6 [WebAssembly] Use `SDValue::getConstantOperandVal` (NFC)
Reviewed By: tlively

Differential Revision: https://reviews.llvm.org/D107499
2021-08-04 21:15:23 -07:00
Matthias Springer 12b34e056c [mlir] Clean up includes in Transforms/Passes.h
Differential Revision: https://reviews.llvm.org/D107520
2021-08-05 11:52:19 +09:00
Nathan Lanza 5848166369 Disable LibFuncs for stpcpy and stpncpy for Android < 21
These functions don't exist in android API levels < 21. A change in
llvm-12 (rG6dbf0cfcf789) caused Oz builds to emit this symbol assuming
it's available and thus is causing link errors. Simply disable it here.

Differential Revision: https://reviews.llvm.org/D107509
2021-08-04 22:48:41 -04:00
Dan Liew fb0a929512 [Compiler-RT] On Apple Platforms switch to always emitting full debug info
Previously the build used `-gline-tables-only` when `COMPILER_RT_DEBUG`
was off (default) and `-g` when `COMPILER_RT_DEBUG` was on. The end
result of this meant that the release build of the Sanitizer runtimes
were difficult to debug (e.g. information about variables and function
arguments were missing).

Presumably the reason for preferring `-gline-tables-only` for release
builds was to save space. However, for Apple platforms this doesn't
matter because debug info lives in separate `.dSYM` files (which aren't
shipped) rather than in the shipped `.dylib` files.

Now on Apple platforms we always emit full debug info if the compiler
supports it and we emit a fatal error if `-g` isn't supported.

rdar://79223184

Differential Revision: https://reviews.llvm.org/D107501
2021-08-04 19:45:33 -07:00
Matt Jacobson 75abeb64ce [AVR] emit 'MCSA_Global' references to '__do_global_ctors' and '__do_global_dtors'
Emit references to '__do_global_ctors' and '__do_global_dtors' to allow
constructor/destructor routines to run.

Reviewed by: MaskRay

Differential Revision: https://reviews.llvm.org/D107133
2021-08-05 10:37:36 +08:00
Matthias Springer ac7c7cbfda [mlir] Update comment in Region.h
The file in which `Region::viewGraph` is defined has changed. This should have been updated with D106342.

Differential Revision: https://reviews.llvm.org/D107517
2021-08-05 10:57:34 +09:00
Fangrui Song 7a6482216f [CMake][gn] lldMachO=>lldMachOOld, lldMachO2=>lldMachO
Now that D95204 switched default to new Darwin backend, rename some CMake
targets to match.

Reviewed By: #lld-macho, smeenai, int3

Differential Revision: https://reviews.llvm.org/D107516
2021-08-04 18:52:41 -07:00
Geoffrey Martin-Noble 693a95a694 [Bazel] Add support for lld
This patch adds a Bazel configuration to build lld. That includes a
BUILD.bazel file to export the libunwind headers for use by lld. Since
the lld target itself requires libxml2 (through WindowsManifest) it's
currently disabled on Buildkite and marked manual, but all the libraries
build.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D107414
2021-08-04 17:59:43 -07:00
Kostya Serebryany 597e407cf2 [libFuzzer] tests/examples for using libFuzzer for out-of-process targets
[libFuzzer] tests/examples for using libFuzzer for out-of-process targets

Reviewed By: kostik

Differential Revision: https://reviews.llvm.org/D107498
2021-08-04 17:37:26 -07:00
modimo 041b525141 [CSSPGO] Remove used of PseudoProbeAttributes::Reserved
D106861 added usage of PseudoProbeAttributes::Reserved as TailCall however this usage hasn't been committed/reviewed. Removing this usage.

Testing
ninja check-all

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D107514
2021-08-04 17:23:56 -07:00
Yonghong Song e52946b9ab BPF: avoid NE/EQ loop exit condition
Kuniyuki Iwashima reported in [1] that llvm compiler may
convert a loop exit condition with "i < bound" to "i != bound", where
"i" is the loop index variable and "bound" is the upper bound.
In case that "bound" is not a constant, verifier will always have "i != bound"
true, which will cause verifier failure since to verifier this is
an infinite loop.

The fix is to avoid transforming "i < bound" to "i != bound".
In llvm, the transformation is done by IndVarSimplify pass.
The compiler checks loop condition cost (i = i + 1) and if the
cost is lower, it may transform "i < bound" to "i != bound".
This patch implemented getArithmeticInstrCost() in BPF TargetTransformInfo
class to return a higher cost for such an operation, which
will prevent the transformation for the test case
added in this patch.

 [1] https://lore.kernel.org/netdev/1994df05-8f01-371f-3c3b-d33d7836878c@fb.com/

Differential Revision: https://reviews.llvm.org/D107483
2021-08-04 16:54:16 -07:00
Catherine Payne 50264ff88a Adding missing filter check to SourceMgrDiagnosticHandler::EmitDiagnostics
There is a case in EmitDiagnostics where the filter check is bypassed (when locationStack is empty).   Filter might also be bypassed when loc instead of showableLoc is added to the locationStack.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D106522
2021-08-04 23:52:00 +00:00
Jessica Paquette ca2e053652 [AArch64][GlobalISel] Legalize wide vector G_PHIs
Clamp the max number of elements when legalizing G_PHI. This allows us to
legalize some common fallbacks like 4 x s64.

Here's an example: https://godbolt.org/z/6YocsEYTd

Had to add -global-isel-abort=0 to legalize-phi.mir to account for the
G_EXTRACT_VECTOR_ELT from the 32 x s8 G_PHI.

Differential Revision: https://reviews.llvm.org/D107508
2021-08-04 16:48:59 -07:00
Pavel Asyutchenko 7df405e079 Apply -fmacro-prefix-map to __builtin_FILE()
This matches the behavior of GCC.
Patch does not change remapping logic itself, so adding one simple smoke test should be enough.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D107393
2021-08-04 16:42:14 -07:00
Michael Jones f135a91c72 [gwpAsan] revert minor change
This change reverts a small cmake change that was causing buildbot
failures.

Differential Revision: https://reviews.llvm.org/D107510
2021-08-04 23:24:04 +00:00
Gus Smith 0bd2d4c4b1 [mlir][sparse] Remove comment w/ code in it
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D107484
2021-08-04 21:41:36 +00:00
Dave Airlie 14cb67862a [OpenCL] allow generic address and non-generic defs for CL3.0
This allows both sets of definitions to exist on CL 3.0

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D107318
2021-08-05 07:32:45 +10:00
Fangrui Song e1574c51c2 [llvm-nm][test] Avoid deprecated alias -M (--print-armap)
-M was inappropriately added since -s is taken by Darwin nm.
-M is deprecated. Tests should use --print-armap instead.
2021-08-04 14:25:24 -07:00
Heejin Ahn 31a71a393f [WebAssembly] Make result of 'catch' inst variadic
`catch` instruction can have any number of result values depending on
its tag, but so far we have only needed a single i32 return value for
C++ exception so the instruction was specified that way. But using the
instruction for SjLj handling requires multiple return values.

This makes `catch` instruction's results variadic and moves selection of
`throw` and `catch` instruction from ISelLowering to ISelDAGToDAG.
Moving `catch` to ISelDAGToDAG is necessary because I am not aware of
a good way to do instruction selection for variadic output instructions
in TableGen. This also moves `throw` because 1. `throw` and `catch`
share the same utility function and 2. there is really no reason we
should do that in ISelLowering in the first place. What we do is mostly
the same in both places, and moving them to ISelDAGToDAG allows us to
remove unnecessary mid-level nodes for `throw` and `catch` in
WebAssemblyISD.def and WebAssemblyInstrInfo.td.

This also adds handling for new `catch` instruction to AsmTypeCheck.

Reviewed By: dschuff, tlively

Differential Revision: https://reviews.llvm.org/D107423
2021-08-04 14:05:33 -07:00
Fangrui Song 9c19b36f1c [X86] Remove -x86-experimental-pref-loop-alignment in favor of -align-loops 2021-08-04 13:23:57 -07:00
Geoffrey Martin-Noble 981ad13ac6 [Bazel] Drop deprecated tblgen includes mechanism
Includes can now be fully managed via td_library and specified locally
to the tablegen files that require them. This has been deprecated for a
while and is not used upstream. I'm not aware of any downstream users
either.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D107389
2021-08-04 13:19:08 -07:00
River Riddle 0bd297fce2 [mlir-lsp-server] Only use one MLIRContext per MLIRTextFile
A text file may be comprised of many different "chunks", when
the input file contains the `// -----` split markers. We don't
need to use a unique MLIRContext per chunk, as having
separate contexts is intended to allow for easy unloading of
unused data and all chunks have the same lifetime (tied to the
input file). This commit uses one context for the entire file,
greatly reducing memory consumption in certain situations (up
to 70%).

Differential Revision: https://reviews.llvm.org/D107488
2021-08-04 20:09:07 +00:00
Michael Jones 6ed60fb8a2 [libc] add integration tests for scudo in libc
This change adds tests to make sure that SCUDO is being properly
included with llvm libc. This change also adds the toggles to properly
use SCUDO, as GWP-ASan is enabled by default and must be included for
SCUDO to function.

Reviewed By: sivachandra, hctim

Differential Revision: https://reviews.llvm.org/D106919
2021-08-04 20:06:09 +00:00
Fangrui Song bd484c9940 [lld] Remove unused LLD_REPOSITORY
Remnant after D72803.

Distributions who want to customize the string can customize
LLD_VERSION_STRING instead.

Reviewed By: #lld-macho, mstorsjo, thakis

Differential Revision: https://reviews.llvm.org/D107416
2021-08-04 13:04:10 -07:00
Fangrui Song a194438615 [CodeGen] Add -align-loops
to `lib/CodeGen/CommandFlags.cpp`. It can replace
-x86-experimental-pref-loop-alignment=.

The loop alignment is only used by MachineBlockPlacement.
The implementation uses a new `llvm::TargetOptions` for now, as
an IR function attribute/module flags metadata may be overkill.

This is the llvm part of D106701.
2021-08-04 12:45:18 -07:00
Michael Liao 5edc886e90 [amdgpu] Add an enhanced conversion from i64 to f32.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D107187
2021-08-04 15:33:12 -04:00
peter klausler 4876520eef [flang] runtime: For Fw.d formatting, don't oscillate forever
The algorithm for Fw.d output will drive binary to decimal conversion for
an initial fixed number of digits, then adjust that number based on the
result's exposent.  For value close to a power of ten, this adjustment
process wouldn't terminate; e.g., formatting 9.999 as F10.2 would start
with 1e2, boost the digits to 2, get 9.99e1, decrease the digits, and loop.
Solve by refusing to boost the digits a second time.

Differential Revision: https://reviews.llvm.org/D107490
2021-08-04 12:19:23 -07:00
peter klausler 617be2756f [flang] Support DFLOAT legacy extension intrinsic function
Like the similar legacy extension FLOAT(), DFLOAT() represents a
conversion from default integer to DOUBLE PRECISION.  Rewrite
into a conversion operation.

Differential Revision: https://reviews.llvm.org/D107489
2021-08-04 12:18:41 -07:00
Nikita Popov bb15861e14 [MemCpyOpt] Relax libcall checks
Rather than blocking the whole MemCpyOpt pass if the libcalls are
not available, only disable creation of new memset/memcpy intrinsics
where only load/stores were used previously. This only affects the
store merging and load-store conversion optimization. Other
optimizations are derived from existing intrinsics, which are
well-defined in the absence of libcalls -- not having the libcalls
just means that call simplification won't convert them to intrinsics.

This is a weaker variation of D104801, which dropped these checks
entirely. Ideally we would not couple emission of intrinsics to
libcall availability at all, but as the intrinsics may be legalized
to libcalls we need to be a bit careful right now.

Differential Revision: https://reviews.llvm.org/D106769
2021-08-04 21:17:51 +02:00
Alfsonso Gregory fb27e8c76e [MLIR][NFC] Get DiagnosticEngine as a reference in doc
'mlir::DiagnosticEngine::DiagnosticEngine(const mlir::DiagnosticEngine&)' is implicitly deleted because the default definition would be ill-formed.

Reviewed By: rdzhabarov

Differential Revision: https://reviews.llvm.org/D107287
2021-08-04 19:00:18 +00:00
Arthur Eubanks 41354942c5 [gn build] Add cfi ignorelist to compiler-rt/lib
So that building the compiler-rt target also copies the cfi ignorelist

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D107411
2021-08-04 11:58:32 -07:00
Alexey Bataev 8f465a0cfb [SLP][NFC]Add tests for constants/undefs used in insertelements, NFC. 2021-08-04 11:52:46 -07:00