Commit Graph

459473 Commits

Author SHA1 Message Date
Vitaly Buka
87d473af69 [NFC][HWASAN] Remove unused parameter 2023-04-29 17:51:18 -07:00
Ian Douglas Scott
34b37c00ab [M68k] Add instruction selection support for zext with PCD addressing
Instruction selection was failing when trying to zero extend a value
loaded from a PC-relative address. This adds support for zero extension
using the "program counter indirect with displacement" addressing mode.
It also adds a test with code that was previously failing to compile.

This fixes a compile error in Rust's libcore.

Differential Revision: https://reviews.llvm.org/D149034
2023-04-29 16:27:16 -07:00
Craig Topper
644f0c0faa [X86] Update some stale comments. NFC 2023-04-29 15:38:37 -07:00
Jakub Kuderski
ef64e5913b [mlir][vector][NFC] Update vector.flat_transpose description
Change the example to match how this op is actually printed. Do not use
'smart quotes' in the description.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D149535
2023-04-29 18:34:34 -04:00
Craig Topper
344368fb98 [TargetLowering] Stop passing an ISD::CondCode to isOperationLegalOrCustom.
ISD::CondCode is a separate num space from opcodes. isOperationLegalOrCustom
should take an opcode.

Reviewed By: barannikov88

Differential Revision: https://reviews.llvm.org/D149528
2023-04-29 15:23:09 -07:00
Craig Topper
ee9cbe3548 [RISCV] Move RISCV::RVVBitsPerBlock from TargetParser to Support/RISCVISAInfo.h.
RISCVTargetParser.h has a dependency on a tablegen generated file.

Using RISCVISAInfo.h instead avoids this dependency.

We just need this constant somewhere visible to the frontend and
backend and I'm trying to avoid adding a header just for it.
2023-04-29 15:04:55 -07:00
Craig Topper
a4797869e7 [RISCV][Sema] Add a build dependency on RISCVTargetParserTableGen after D145088.
Need to find a better home for RISCV::RVVBitsPerBlock to remove
this dependency. This just a quick fix to fix the build.
2023-04-29 13:33:54 -07:00
Florian Hahn
b14be1e7c0
[SCEV] Use object size for globals to sharpen ranges.
The highest address the object can start is ObjSize bytes before the
end (unsigned max value). If this value is not a multiple of the
alignment, the last possible start value is the next lowest multiple
of the alignment. Note: The computations cannot overflow,
because if they would there's no possible start address for the
object.

At the moment, this is limited to GlobalVariables, because I could not
find a API similar to getObjectSize to also get the alignment of the
object. With such an API, this can be generalized to general addresses.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D149483
2023-04-29 21:33:30 +01:00
Matt Arsenault
b2fcab1c34 GlobalOpt: Add some test coverage for addrspacecast treatment 2023-04-29 16:06:01 -04:00
David Green
f1961153c2 [ARM] Add predicated shift patterns
This uses the patterns defined in MVE_TwoOpPattern to add predicated patterns
for vshls/u instructions.

Differnetial Revision: https://reviews.llvm.org/D149366
2023-04-29 20:32:54 +01:00
Matt Arsenault
70d9c62f54 AMDGPU: Don't need pointer bitcast in AMDGPULowerKernelArguments 2023-04-29 15:11:31 -04:00
Sergei Barannikov
e744e51b12 [SelectionDAG] Rename ADDCARRY/SUBCARRY to UADDO_CARRY/USUBO_CARRY (NFC)
This will make them consistent with other overflow-aware nodes.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D148196
2023-04-29 21:59:58 +03:00
Noah Goldstein
7d3f127530 [emacs] Highlight 'ptr' keyword as a type
Seems natural to highlight 'ptr' same as 'void', 'i1', etc...

Reviewed By: artagnon, nikic

Differential Revision: https://reviews.llvm.org/D149519
2023-04-29 13:49:25 -05:00
Noah Goldstein
dc13624e88 [InstCombine] Fold (cmp eq/ne (umax X, Y),0) -> (cmp eq/ne (or X, Y),0)
`or` is almost always preferable.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D149426
2023-04-29 12:38:43 -05:00
Noah Goldstein
ecad53c3f4 [InstCombine] Don't fold uadd.sat to or if it increase instruction count
In the `(cmp eq/ne (uadd.sat X, Y),0)` case, we where missing a
`hasOneUse` check.

Differential Revision: https://reviews.llvm.org/D149425
2023-04-29 12:38:41 -05:00
Noah Goldstein
585af9e39f [InstCombine] Add tests (cmp eq/ne (umax/uadd.sat X, Y), 0); NFC
Differential Revision: https://reviews.llvm.org/D149424
2023-04-29 12:38:37 -05:00
Craig Topper
df017ba9d3 [TargetLowering] Don't use ISD::SELECT_CC in expandFP_TO_INT_SAT.
This function gets called for vectors and ISD::SELECT_CC was never
intended to support vectors. Some updates were made to support
it when this function started getting used for vectors.

Overall, using separate ISD::SETCC and ISD::SELECT looks like an
improvement even for scalar.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D149481
2023-04-29 10:23:08 -07:00
Stefan Gränitz
64a2520bac [lldb][ObjectFileELF] Support AArch32 in ApplyRelocations
Allow the ObjectFileELF plugin to resolve R_ARM_ABS32 relocations from AArch32 object files. This fixes https://github.com/llvm/llvm-project/issues/61948

The existing architectures work with RELA-type relocation records that read addend from the relocation entry. REL-type relocations in AArch32 store addend in-place.
The new function doesn't re-use ELFRelocation::RelocAddend32(), because the interface doesn't match: in addition to the relocation entry we need the actual target section memory.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D147642
2023-04-29 17:34:39 +02:00
Matt Arsenault
d605af371e AMDGPU: Don't need pointer bitcasts in AMDGPURewriteOutArguments 2023-04-29 10:35:06 -04:00
Matt Arsenault
d153741574 AMDGPU: Remove code to create pointer bitcasts in atomicrmw expansion 2023-04-29 10:35:06 -04:00
Matt Arsenault
3e16167c14 AMDGPU: Use getTypeStoreSizeInBits 2023-04-29 10:35:06 -04:00
Matt Arsenault
4202ad5d94 AMDGPU: Don't create a pointer bitcast in AMDGPULateCodeGenPrepare 2023-04-29 10:34:21 -04:00
Matt Arsenault
3ae5f74f54 AMDGPU: Don't try to create pointer bitcasts in kernarg lowering 2023-04-29 10:04:45 -04:00
Matt Arsenault
6a0d0711ce AMDGPU: Don't try to create pointer bitcasts in load widening 2023-04-29 10:04:33 -04:00
Matt Arsenault
b52db60cbb GlobalOpt: Drop code to handle typed pointers
Fixes assert with pointers with different address spaces. We
could keep looking through addrspacecast, but it would require
checking for null handling of the access address space.

Fixes #62384
2023-04-29 09:48:21 -04:00
Joseph Huber
1b823abea7 [libc] Add support for global ctors / dtors for AMDGPU
This patch makes the necessary changes to support calling global
constructors and destructors on the GPU. The patch in D149340 allows the
`lld` linker to create the symbols pointing us to these globals. These
should be executed by a single thread, which is more difficult on the
GPU because all threads are active. I chose to use an atomic counter to
sync every thread on the GPU. This is very slow if you use more than a
few thousand threads, but for testing purposes it should be sufficient.

Depends on D149340 D149363

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D149398
2023-04-29 08:40:20 -05:00
Joseph Huber
a1da746157 [AMDGPU] Place global constructors in .init_array and .fini_array
For the GPU, we emit external kernels that call the initializers and
constructors, however if we had a persistent kernel like in the `_start`
kernel for the `libc` project, we could initialize the standard way of
calling constructors. This patch adds new global variables containing
pointers to the constructors to be called. If these are placed in the
`.init_array` and `.fini_array` sections, then the backend will handle
them specially. The linker will then provide the `__init_array_` and
`__fini_array_` sections to traverse them. An implementation would look
like this.

```
extern uintptr_t __init_array_start[];
extern uintptr_t __init_array_end[];
extern uintptr_t __fini_array_start[];
extern uintptr_t __fini_array_end[];

using InitCallback = void(int, char **, char **);
using FiniCallback = void(void);

extern "C" [[gnu::visibility("protected"), clang::amdgpu_kernel]] void
_start(int argc, char **argv, char **envp) {
  uint64_t init_array_size = __init_array_end - __init_array_start;
  for (uint64_t i = 0; i < init_array_size; ++i)
    reinterpret_cast<InitCallback *>(__init_array_start[i])(argc, argv, env);
  uint64_t fini_array_size = __fini_array_end - __fini_array_start;
  for (uint64_t i = 0; i < fini_array_size; ++i)
    reinterpret_cast<FiniCallback *>(__fini_array_start[i])();
}
```

Reviewed By: yaxunl

Differential Revision: https://reviews.llvm.org/D149340
2023-04-29 08:40:19 -05:00
Matt Arsenault
bc37be1855 LangRef: Add "dynamic" option to "denormal-fp-math"
This is stricter than the default "ieee", and should probably be the
default. This patch leaves the default alone. I can change this in a
future patch.

There are non-reversible transforms I would like to perform which are
legal under IEEE denormal handling, but illegal with flushing zero
behavior. Namely, conversions between llvm.is.fpclass and fcmp with
zeroes.

Under "ieee" handling, it is legal to translate between
llvm.is.fpclass(x, fcZero) and fcmp x, 0.

Under "preserve-sign" handling, it is legal to translate between
llvm.is.fpclass(x, fcSubnormal|fcZero) and fcmp x, 0.

I would like to compile and distribute some math library functions in
a mode where it's callable from code with and without denormals
enabled, which requires not changing the compares with denormals or
zeroes.

If an IEEE function transforms an llvm.is.fpclass call into an fcmp 0,
it is no longer possible to call the function from code with denormals
enabled, or write an optimization to move the function into a denormal
flushing mode. For the original function, if x was a denormal, the
class would evaluate to false. If the function compiled with denormal
handling was converted to or called from a preserve-sign function, the
fcmp now evaluates to true.

This could also be of use for strictfp handling, where code may be
changing the denormal mode.

Alternative name could be "unknown".

Replaces the old AMDGPU custom inlining logic with more conservative
logic which tries to permit inlining for callees with dynamic handling
and avoids inlining other mismatched modes.
2023-04-29 08:44:59 -04:00
Jacques Pienaar
0610e2f6a2 [mlir][bytecode] Allow client to specify a desired version.
Add method to set a desired bytecode file format to generate. Change
write method to be able to return status including the minimum bytecode
version needed by reader. This enables generating an older version of
the bytecode (not dialect ops, attributes or types). But this does not
guarantee that an older version can always be generated, e.g., if a
dialect uses a new encoding only available at later bytecode version.
This clamps setting to at most current version.

Differential Revision: https://reviews.llvm.org/D146555
2023-04-29 05:35:53 -07:00
Tom Praschan
cb133a4629 [clangd] Hover: Add CalleeArgInfo for constructor expressions
Differential Revision: https://reviews.llvm.org/D147847
2023-04-29 14:37:16 +02:00
NAKAMURA Takumi
81b1f4746f [CMake] Serialize build_native_tool
To prevent race in `NATIVE`, let each action depend on preceding action.
At the moment, this is restricted only for "Visual Studio".

For example,

  - `llvm-tblgen-host` depends on the target's `llvm-tblgen`.
  - `clang-tblgen-host` depends on the target's `clang-tblgen` and `llvm-tblgen-host`.

This is rework for D54153.
`build_native_tool` has been introduced since D60024.

Differential Revision: https://reviews.llvm.org/D149072
2023-04-29 16:53:41 +09:00
Jon Phillips
c12aa69a0b [clang-format] Add BracedInitializerIndentWidth option
The option allows users to specify how many columns to use to indent
the contents of initializer lists.

Closes #51070.

Differential Revision: https://reviews.llvm.org/D146101
2023-04-29 00:36:19 -07:00
Luo, Yuanke
40222ddcf8 [X86] Fix the vnni machine combine issue.
The previous patch (D148980) didn't set the InstrIdxForVirtReg correctly
in genAlternativeDpCodeSequence(). It causes vnni lit test failure when
LLVM_ENABLE_EXPENSIVE_CHECKS is on.
2023-04-29 13:51:08 +08:00
Hans Wennborg
667b8396ef Revert "Reland D147337 "[tsan] Add debugging interfaces into interface header.""
This broke the lit tests on Mac, see comment on the code review.

> This change the types to match the ones used in:
> Darwin/debug_external.cpp
> debugging.cpp
>
> Reviewed By: vitalybuka
>
> Differential Revision: https://reviews.llvm.org/D148214

This reverts commit ea7d6e658e.
2023-04-29 07:06:16 +02:00
Yeting Kuo
74e931849e [RISCV] Disable strict node mutation and use correct lowering action of strict_fsetcc(s).
The patch disables strict node mutation by setting IsStrictFPEnabled to true.
It also fixes wrong lowering action of strict_fsetcc(s).

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D149320
2023-04-29 11:53:07 +08:00
NAKAMURA Takumi
78ceb39b01 GOFFObjectFile.cpp: Suppress a warning in -Asserts (D98437) 2023-04-29 11:33:41 +09:00
Joseph Huber
91528d2058 [libc] Fix printing on the GPU when given a cpp::string_ref
The implementation of the test printing currently expects a null
terminated C-string. However, the `write_to_stderr` interface uses a
string view, which doesn't need to be null terminated. This patch
changes the printing interface to directly use `fwrite` instead rather
than relying on a null terminator.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D149493
2023-04-28 21:32:01 -05:00
Manna, Soumi
e52a8b89ad [NFC][clang] Fix static analyzer concerns about AUTO_CAUSES_COPY
Reported by Coverity:

AUTO_CAUSES_COPY
Unnecessary object copies can affect performance

1. Inside "ODRHash.cpp" file, in clang::ODRHash::AddCXXRecordDecl(clang::CXXRecordDecl const *): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.

2. Inside "Tokens.cpp" file, in clang::syntax::TokenBuffer::dumpForTests[abi:cxx11](): Using the auto keyword without an & causes the copy of an object of type DenseMapPair.

3. Inside "TargetID.cpp" file, in clang::getCanonicalTargetID[abi:cxx11](llvm::StringRef, llvm::StringMap<bool, llvm::MallocAllocator> const &): Using the auto keyword without an & causes the copy of an object of type pair.

Reviewed By: tahonermann, aaron.ballman

Differential Revision: https://reviews.llvm.org/D148639
2023-04-28 18:58:55 -07:00
Uday Bondhugula
43735204d5 Simplify affine bound min or max with operands
Add canonicalization for affine.for bounds to use operand info (when
operands are outer loop affine.for IVs) to simplify bounds: redundant
bound expressions are eliminated in specific cases that are easy to
check and well-suited for op canonicaliation. If the lowest or the
highest value the affine expression can take is already covered by other
constant bounds, the expression can be removed.

Eg:
`min (d0) -> (32 * d0 + 32, 32)(%i) where 0 <= %i < 2`

The first expression can't be less than 32 and can be simplified away
with a lightweight local rewrite.

This simplification being part of canonicalization only handles simple
expressions, specifically, a sum of products of operands with constants.
This is a very common and a dominant case where such simplification is
desired. These can be flattened without any local variables.

Reviewed By: dcaballe, springerm

Differential Revision: https://reviews.llvm.org/D149007
2023-04-29 07:12:54 +05:30
Vitaly Buka
5a5bf053d8 [HWASAN] Support short granules in __hwasan_test_shadow
Reviewed By: thurston

Differential Revision: https://reviews.llvm.org/D149430
2023-04-28 18:34:34 -07:00
Vitaly Buka
edc6960931 Revert "[HWASAN] Support short granules in __hwasan_test_shadow"
Acidentally relanded without the fix.

This reverts commit 008c3934ab.
2023-04-28 18:31:03 -07:00
Vitaly Buka
008c3934ab [HWASAN] Support short granules in __hwasan_test_shadow
Reviewed By: thurston

Differential Revision: https://reviews.llvm.org/D149430
2023-04-28 18:29:01 -07:00
Jason Molenda
5679379cc7 Refactor and generalize AArch64 watchpoint support in debugserver
Refactor the debugserver watchpiont support in anticipating of
adding support for AArch64 MASK hardware watchpoints to watch
larger regions of memory.  debugserver already had support for
handling a request to watch an unaligned region of memory up
to 8 bytes using Byte Address Select watchpoints - it would split
an unaligned watch request into two aligned doublewords that
could be watched with two hardware watchpoints using the BAS
specification.

This patch generalizes that code for properly aligning, and
possibly splitting, a watchpoint request into two hardware watchpoints
to handle any size request.  And separates out the specifics
about BAS watchpoints into its own method, so a sibling method
for MASK watchpoints can be dropped in next.

Differential Revision: https://reviews.llvm.org/D149040
rdar://108233371
2023-04-28 18:24:38 -07:00
Jason Molenda
13d613de4b Remove i386 and armv7 native support in debugserver
i386 and armv7 macOS/iOS cannot be built with current Xcode
any longer; we cannot build or test the support code for running
debugserver on these targets.  Remove the code.

Differential Revision: https://reviews.llvm.org/D149503
2023-04-28 18:19:43 -07:00
Jonas Devlieghere
13dbc16b4d
[lldb] Refactor host::OpenFileInExternalEditor
This patch refactors the macOS implementation of
OpenFileInExternalEditor. It fixes an AppleEvent memory leak, the
caching of LLDB_EXTERNAL_EDITOR and speculatively fixes a crash when
CFURL is NULL (rdar://108633464). The new code also improves error
handling, readability and documents calls to the CoreFoundation Launch
Services APIs.

A bunch of the Launch Services APIs have been deprecated
(LSFindApplicationForInfo, LSOpenURLsWithRole). The preferred API is
LSOpenCFURLRef but it doesn't specifying the "location" Apple Event
which is used to highlight the current line and switching over would
regress the existing behavior.

rdar://108633464

Differential revision: https://reviews.llvm.org/D149482
2023-04-28 18:12:41 -07:00
Vitaly Buka
bfb5a4fd53 Revert "[HWASAN] Support short granules in __hwasan_test_shadow"
Break internal tests, but it supposed to be almost NFC.

This reverts commit bf12b74637.
2023-04-28 17:41:09 -07:00
Craig Topper
578413751c [RISCV] Add a DAG combine to fold (add (xor (setcc X, Y), 1) -1)->(neg (setcc X, Y)). 2023-04-28 16:52:55 -07:00
Mahesh Ravishankar
b06744057f [mlir][Tensor] Dont drop attributes during tiling.
Reviewed By: hanchung

Differential Revision: https://reviews.llvm.org/D149120
2023-04-28 23:45:42 +00:00
LLVM GN Syncbot
f6dfc5a4ed [gn build] Port 2fa6bcf02f 2023-04-28 23:32:00 +00:00
Jie Fu
02bc772de7 Fix use of undeclared identifier 'EC' (NFC)
/Users/jiefu/llvm-project/llvm/lib/Object/GOFFObjectFile.cpp:199:3: error: use of undeclared identifier 'EC'
  EC = ConverterEBCDIC::convertToUTF8(SymbolName, SymbolNameConverted);
  ^
1 error generated.
2023-04-29 07:30:35 +08:00