Commit Graph

486862 Commits

Author SHA1 Message Date
Pete Lawrence
c82b7fddfc
[lldb] Remove redundant severity substring within a diagnostic message. (#76111)
For example, the following message has the severity string "error: "
twice.
	> "error: <EXPR>:3:1: error: cannot find 'bogus' in scope

This method already appends the severity string in the beginning, but
with this fix, it also removes a secondary instance, if applicable.

Note that this change only removes the *first* redundant substring. I
considered putting the removal logic in a loop, but I decided that if
something is generating more than one redundant severity substring, then
that's a problem the message's source should probably fix.

rdar://114203423
2024-01-18 12:04:26 -08:00
Kareem Ergawy
99cae9a44f
[flang] Fix seg fault CodeGenAction::executeAction() (#78269) 2024-01-18 20:36:27 +01:00
Vlad Serebrennikov
a7588bb9ba [clang] Pass -n to llvm-cxxfilt in even more codegen tests
This is another follow-up to f4fbbebb5e and 30da0f5a35
2024-01-18 22:22:38 +03:00
Usama Hameed
911289a62b
[CompilerRT][ASan] Add new substitutions for tests while using lto to (#78523)
explicitly pass libLTO path. This fixes a failure in swift-ci where
libLTO was being picked from the system instead which was an older
version and caused issues.

rdar://117474861
2024-01-18 11:13:56 -08:00
Alexandre Ganea
cfc9f3695f Revert "[lldb] Silence narrowing conversion warning with MSVC"
This reverts commit cb67dc1925.
2024-01-18 14:13:07 -05:00
Haopeng Liu
a58ad3e2a3
[clang] Add size filter for stack auto init (#74777)
Add a clang flag, "-ftrivial-auto-var-init-max-size=" so that clang
skips auto-init a variable if the auto-init memset size exceeds the flag
setting (in bytes). Note that this skipping doesn't apply to
runtime-sized variables like VLA.

Considerations: "__attribute__((uninitialized))" can be used to manually
opt variables out. However, there are thousands of large variables
(e.g., >=1KB, most of them are arrays and used as buffers) in big
codebase. Manually opting them out one by one is not efficient.
2024-01-18 11:10:16 -08:00
Peter Klausler
fa6c3df6ad
[flang] Don't use \uXXXX encodings unless \-escapes are enabled (#78326)
Don't put \uXXXX escapes into the cooked character stream while
prescanning; it should always be UTF-8.
2024-01-18 11:05:04 -08:00
Ricky Zhou
1522333c3c
[ThinLTO][DebugInfo] Emit full type definitions when importing anonymous types. (#78461)
This fixes some cases of missing debuginfo caused by an interaction
between:


f0d66559ea,
which drops the identifier from a DICompositeType in the module
containing its
vtable.

and


a61f5e3796,
which causes ThinLTO to import composite types as declarations when they
have
an identifier.

If a virtual class's DICompositeType has no identifier due to the first
change,
and contains a nested anonymous type which does have an identifier, then
the
second change can cause ThinLTO to output the classes's DICompositeType
as a
type definition that links to a non-defining declaration for the nested
type.
Since the nested anonyous type does not have a name, debuggers are
unable to
find the definition for the declaration.

Repro case:
```
cat > a.h <<EOF
class A {
 public:
  A();
  virtual ~A();

 private:
  union {
    int val;
  };
};
EOF

cat > a.cc <<EOF
#include "a.h"

A::A() { asm(""); }

A::~A() {}
EOF

cat > main.cc <<EOF
#include "a.h"

int main(int argc, char **argv) {
  A a;
  return 0;
}
EOF

clang++ -O2 -g -flto=thin -mllvm -force-import-all main.cc a.cc
gdb ./a.out -batch -ex 'pt /rmt A'
```

The gdb command outputs:
```
type = class A {
  private:
    union {
        <incomplete type>
    };
}
```

and dwarfdump -i a.out shows a DW_TAG_class_type for A with an
incomplete union
type (note that there is also a duplicate entry with the full union type
that
comes after).
```
< 1><0x0000001e>    DW_TAG_class_type
                      DW_AT_containing_type       <0x0000001e>
                      DW_AT_calling_convention    DW_CC_pass_by_reference
                      DW_AT_name                  (indexed string: 0x00000007)A
                      DW_AT_byte_size             0x00000010
                      DW_AT_decl_file             0x00000001 /path/to/./a.h
                      DW_AT_decl_line             0x00000001
...
< 2><0x0000002f>      DW_TAG_member
                        DW_AT_type                  <0x00000037>
                        DW_AT_decl_file             0x00000001 /path/to/./a.h
                        DW_AT_decl_line             0x00000007
                        DW_AT_data_member_location  8
< 2><0x00000037>      DW_TAG_union_type
                        DW_AT_export_symbols        yes(1)
                        DW_AT_calling_convention    DW_CC_pass_by_value
                        DW_AT_declaration           yes(1)
```

This change works around this by making ThinLTO always import full
definitions
for anonymous types.
2024-01-18 10:55:30 -08:00
Alexandre Ganea
0ac992e0ad [openmp] Revert 64874e5ab5 since it was committed by mistake and the PR (https://github.com/llvm/llvm-project/pull/77853) wasn't approved yet. 2024-01-18 13:55:03 -05:00
Alan Zhao
2c9f04c98a
[clang] Fix parenthesized list initialization of arrays not working with new (#76976)
This bug is caused by parenthesized list initialization not being
implemented in `CodeGenFunction::EmitNewArrayInitializer(...)`.

Parenthesized list initialization of `struct`s with `operator new`
already works in Clang and is not affected by this bug.

Additionally, fix the test new-delete.cpp as it incorrectly assumes that
using parentheses with operator new to initialize arrays is illegal for
C++ versions >= C++17.

Fixes #68198
2024-01-18 10:53:54 -08:00
kyulee-com
5de1d007dd
[lld-macho] Fix for objc_msgSend stubs (#78557)
This commit corrects the address computation for objc_msgSend stubs.
Previously, the address computation was incidentally correct due to
objc_msgSend often being the first entry in the got section, resulting
in a 0 index. This commit ensures accurate address computation
regardless of the objc_msgSend stub's position in the got section.
2024-01-18 10:46:30 -08:00
Dave Lee
45d1cca339
[llvm][utils] Fix SmallString summary provider (#78527)
Fixes `SmallString` summary provider, which was incorrectly producing the empty string. 
Initially I thought the strings I was debugging were empty for unknown reasons, but 
that was not the case.
2024-01-18 10:35:18 -08:00
Philip Reames
2663d2cb9c
[RISCV] Adjust select shuffle cost to reflect mask creation cost (#77963)
This is inspired by
https://github.com/llvm/llvm-project/pull/77342#pullrequestreview-1814673242,
and is split off of same with some differences in style.

A select is a vmerge.vv with the additional cost of materializing the
bitmask vector in a vreg. All masks fit within a single vector register
(e8 + m8 is the worst case), and thus our worst case cost should be
roughly 3 (2 scalar to produce the address, one vector load op). Given
most shuffles are small, and the mask will be instead produced by
LUI/ADDI + vmv.s.x or ADDI + vmv.s.x, using 2 as the default seems quite
reasonable. At worst, we're not going to be off by much.

The prior lowering scaled the cost of the bitmask with LMUL, which I
don't understand. At m1 it did use the same base cost of 2. (@lukel97
You wrote the original code here, anything I'm missing here?)
2024-01-18 10:24:47 -08:00
Alex MacLean
0c195e5096
[NVPTX][NFC] Remove unused parameter of getArgumentAlignment (#78604) 2024-01-18 10:08:56 -08:00
Alexandre Ganea
cb67dc1925 [lldb] Silence narrowing conversion warning with MSVC
Fixes:
```
[13/270] Building CXX object tools\lldb\unittests\Core\CMakeFiles\LLDBCoreTests.dir\DumpDataExtractorTest.cpp.obj
C:\git\llvm-project\lldb\unittests\Core\DumpDataExtractorTest.cpp(140): warning C4305: 'argument': truncation from 'double' to 'const std::complex<float>::_Ty'
```
2024-01-18 13:06:12 -05:00
Alexandre Ganea
ded8aa6184 [lldb] Silence warning with latest MSVC
Fixes several of these:
```
[3370/3822] Building CXX object tools\lldb\source\Plugins\Process\U...lldbPluginProcessUtility.dir\NativeRegisterContextDBReg_x86.cpp.ob
C:\git\llvm-project\lldb\source\Plugins\Process\Utility\NativeRegisterContextDBReg_x86.h(23): warning C4589: Constructor of abstract class 'lldb_private::NativeRegisterContextDBReg_x86' ignores initializer for virtual base class 'lldb_private::NativeRegisterContextRegisterInfo'
C:\git\llvm-project\lldb\source\Plugins\Process\Utility\NativeRegisterContextDBReg_x86.h(23): note: virtual base classes are only initialized by the most-derived type
```
2024-01-18 13:06:12 -05:00
Alexandre Ganea
bafdaa171a [lldb] Silence warning with latest MSVC on Windows
Fixes:
```
[3465/3822] Building CXX object tools\lldb\source\Plugins\SymbolFile\CTF\CMakeFiles\lldbPluginSymbolFileCTF.dir\SymbolFileCTF.cpp.obj
C:\git\llvm-project\lldb\source\Plugins\SymbolFile\CTF\SymbolFileCTF.cpp(606) : warning C4715: 'lldb_private::SymbolFileCTF::CreateType': not all control paths return a value
```
2024-01-18 13:06:12 -05:00
Alexandre Ganea
d950157f7b [lldb] Silence warning when building with latest MSVC
Fixes:
```
C:\git\llvm-project\lldb\unittests\Core\DumpDataExtractorTest.cpp(140): warning C4305: 'argument': truncation from 'double' to 'const std::complex<float>::_Ty'
```
2024-01-18 13:06:12 -05:00
Natalie Chouinard
c21f48e5ad
[HLSL][SPIR-V] Add Vulkan to target triple (#76749)
Add support for specifying the logical SPIR-V target environment in the
triple as Vulkan. When compiling HLSL, this replaces the DirectX Shader
Model with a Vulkan environment instead.

Currently, the only supported combinations of SPIR-V version and Vulkan
environment are:
- Vulkan 1.2 and SPIR-V 1.5
- Vulkan 1.3 and SPIR-V 1.6

Fixes #70051
2024-01-18 12:52:00 -05:00
Mark de Wever
b689e1678c
[libc++] Renames ABI tag. (#78342)
The tag name was long for an ABI tag. The name was misleading too, the
tag is first introduced in LLVM 18 in 2024 and not in 2023.

---------

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2024-01-18 18:46:46 +01:00
Dominik Wójt
7f05153236
[libc++] Un-xfail module tests in picolibc tests (#78580)
Some of the module tests now pass after picolibc update.
https://github.com/llvm/llvm-project/pull/77908

The remaining tests fail and are now set to xfail on picolibc
specifically.
2024-01-18 18:40:52 +01:00
Vlad Serebrennikov
30da0f5a35 [clang] Pass -n to llvm-cxxfilt in codegen tests
This is a follow-up to f4fbbebb5e, which addresses macOS test failure.
2024-01-18 20:25:18 +03:00
Jonas Paulsson
964565f42e
[SystemZ] i128 cost model (#78528)
Update SystemZTTI to reflect the recent change of handling i128 as a
legal type in vector registers.
2024-01-18 18:23:57 +01:00
Andrei Golubev
15c1c85470
[LLVM][ADT] Convert llvm::hash_code to unsigned explicitly in DenseMapInfo (#77743)
The getHashValue() signature returns a value of type 'unsigned' while
the hash_code could only be implicitly converted to 'size_t'. Depending
on the C++ implementation, this may or may not be a narrowing
conversion.

On some platform/compiler combination, this becomes a warning. To avoid
the warning (and better highlight the narrowing), do an explicit
conversion instead.

Co-authored-by: Orest Chura <orest.chura@intel.com>
2024-01-19 04:16:48 +11:00
Ben Langmuir
b08aca7a4f [ORC][MachO] Support common load commands in the platform's mach-o header builder
Add a HeaderOptions struct that can be used to configure commonly-used
load commands LC_ID_DYLIB, LC_LOAD_DYLIB, and LC_RPATH when setupDylib
creates a mach-o header.
2024-01-18 09:14:15 -08:00
Lang Hames
ab244b64df [ORC] Specialize MachOBuilder support for the LC_ID_DYLIB command.
Provides a natural API for adding LC_ID_DYLIB commands, including the arbitrary
install name.
2024-01-18 09:14:15 -08:00
Valentin Clement (バレンタイン クレメン)
b06bc7c6a0
[mlir][flang][openacc] Device type support on acc routine op (#78375)
This patch add support for device_type on the acc.routine operation.
device_type can be specified on seq, worker, vector, gang and bind
information.

The support is following the same design than the one for compute
operations, data operation and the loop operation.
2024-01-18 09:04:11 -08:00
Joseph Huber
cb2f340850 [CUDA] Disable registering surfaces and textures with the new driver
Summary:
These runtime calls don't seem to be supported anymore, disable them for
now.
2024-01-18 10:56:33 -06:00
Vyacheslav Levytskyy
774b957786
[SPIR-V] improve performance of Module Analysis stage in the part of processing "other instructions" (#76047)
The goal of this PR is to fix an issue when Module Analysis stage is not
able to complete processing of a really big LLVM source:
https://github.com/llvm/llvm-project/issues/76048.

There is an example of a bulky LLVM source:
https://github.com/KhronosGroup/SPIRV-LLVM-Translator/blob/main/test/SpecConstants/long-spec-const-composite.ll

Processing of this file with
`llc -mtriple=spirv64-unknown-unknown -O0 long-spec-const-composite.ll
-o long-spec-const-composite.spvt`
to produce SPIR-V output using LLVM SPIR-V backend takes too long, and
I've never been able to see it actually completes. After the patch from
this PR applied elapsed time for me is ~30 sec.

The fix changes underlying data structure to be `std::set` to trace
instructions with identical operands instead of the existing approach of
the `findSameInstrInMS()` function.
2024-01-18 08:48:38 -08:00
David Spickett
b75b9d82f5 [lldb] Correct function names in ProcessGDBRemote::ParseFlagsFields log messages
This has to be specified in the string because otherwise we'd get the
lambda's name, and I incorrectly used the name of the calling function here.
2024-01-18 16:46:38 +00:00
Joseph Huber
2b804f8755 [LinkerWrapper][Obvious] Fix move on temporary object
Summary:
This causes warnings because it is already a temporary and does not need
to be moved.
2024-01-18 10:42:13 -06:00
Fehr Mathieu
914cfa4138
[mlir][irdl] Add irdl.base op (#76400)
The `irdl.base` op represent an attribute constraint that will check
that the
base of a type or attribute is the expected one (e.g. `IntegerType`) .

Example:

```mlir
irdl.dialect @cmath {
  irdl.type @complex {
    %0 = irdl.base "!builtin.integer"
    irdl.parameters(%0)
  }

  irdl.type @complex_wrapper {
    %0 = irdl.base @complex
    irdl.parameters(%0)
  }
}
```

The above program defines a `cmath.complex` type that expects a single
parameter, which is a type with base name `builtin.integer`, which is
the
name of an `IntegerType` type.
It also defines a `cmath.complex_wrapper` type that expects a single
parameter, which is a type of base type `cmath.complex`.
2024-01-18 16:31:40 +00:00
XinWang10
d124b02242
[X86][MC] Fix wrong encoding of promoted BMI instructions due to missing NoCD8 (#78386)
Address review comments in #76709

Add `NoCD8` to class `ITy`, and rewrite the promoted instructions with
`ITy` to avoid unexpected incorrect encoding about `NoCD8`.
2024-01-19 00:27:16 +08:00
Shengchen Kan
8bc7c0a058 [X86] Fix failures on EXPENSIVE_CHECKS builds
Error message

```
*** Bad machine code: Illegal virtual register for instruction ***
- function:    test__blsi_u32
- basic block: %bb.0  (0x7a61208)
- instruction: %5:gr32 = MOV32r0 implicit-def $eflags
- operand 0:   %5:gr32
Expected a GR32_NOREX2 register, but got a GR32 register
```

Reported by RKSimon in #77433

The failure is b/c compiler emits a MOV32r0 with operand GR32 when
fast-isel is enabled.

```
// X86FastISel.cpp
Register SrcReg = fastEmitInst_(X86::MOV32r0, &X86::GR32RegClass)
```

However, before this patch, compiler only allows GR32_NOREX operand
b/c MOV32r0 is a pseudo instruction. In this patch, we relax the
register class of the operand to GR32 b/c MOV32r0 is always expanded
to XOR32rr, which can use EGPR.

The bug was not introduced by #77433 but caught by it.
2024-01-19 00:19:55 +08:00
Nick Desaulniers
3044d75485
[libc][arm] add more math.h entrypoints (#77839)
In particular, we have internal customers that would like to use nanf
and
scalbnf.

The differences between various entrypoint files can be checked via:

    $ comm -3 <(grep libc\.src path/to/entrypoints.txt | sort) \
       <(grep libc\.src path/to/other/entrypoints.txt | sort)
2024-01-18 08:18:13 -08:00
Nick Desaulniers
de03c46b8b
[libc] reverts for 32b arm (#78307)
These were fixed properly by f1f1875c18.

- Revert "[libc] temporarily set -Wno-shorten-64-to-32 (#77396)"
- Revert "[libc] make off_t 32b for 32b arm (#77350)"
2024-01-18 08:17:19 -08:00
Zequan Wu
f4ede08c61
[lldb][Format] Fix missing inlined function names in frame formatting. (#78494)
This fixes missing inlined function names when formatting frame and the
`Block` in `SymbolContext` is a lexical block (e.g.
`DW_TAG_lexical_block` in Dwarf).
2024-01-18 11:06:57 -05:00
Nikita Popov
f20488687e [CVP] Add test with nested cycle (NFC)
This is a regression test for a miscompile that would have been
introduced by an upcoming patch.
2024-01-18 16:57:29 +01:00
Aart Bik
9cd4128998
[mlir][sparse] add a 3-d block and fiber test (#78529) 2024-01-18 07:52:42 -08:00
Joseph Huber
12c90bd612
[LinkerWrapper] Handle AMDGPU Target-IDs correctly when linking (#78359)
Summary:
The linker wrapper's job is to sort various embedded inputs into a list
of files that participate in a single link job. So far, this has been
completely 1-to-1, that is, each input file participates in exactly one
link job. However, support for AMD's target-id requires that one input
file may participate in multiple link jobs. For example, if given a
`gfx90a` static library and a `gfx90a:xnack+` object file input, we
should link the gfx90a` target into the `gfx90a:xnack+` job. These are
considered separate CPUs that can be mutually linked more or less.

This patch adds the necessary logic to make this happen. It primarily
reworks the logic to copy relevant input files into a separate list. So,
it moves construction of the final list of link jobs into the extraction
phase. We also need to copy the files in the case that it is needed more
than once, as the entire workflow expects ownership of said file.
2024-01-18 09:44:56 -06:00
Simon Pilgrim
110e1717b3 [X86] X86MCInstLower.cpp - fix spelling mistake 2024-01-18 15:44:27 +00:00
Krzysztof Drewniak
aac23b08e3
[mlir][ROCDL] Stop setting amdgpu-implicitarg-num-bytes (#78498)
Clang stopped doing this late 2021 back in 33315ef321, and no other
frontent does this, so stop doing it.
2024-01-18 09:43:46 -06:00
Krzysztof Drewniak
05e85e4fc5
[mlir][Math] Add pass to legalize math functions to f32-or-higher (#78361)
Since most of the operations in the `math` dialect don't have
low-precision implementations, add the -math-legalize-to-f32 pass that
goes through and brackets low-precision math funcitons (like `math.sin
%0 : f16`) with `arith.extf` and `arith.truncf`. This preserves the
original semantics of the math operation but allows lowering to proceed.

Versions of this lowering are already implicitly present in some passes,
like ConvertGPUToROCDL. However, because those are implicit rewrites,
they hide the floating-point extension and truncation, preventing anyone
from writing passes that operate on those implitic extf/truncf pairs.

Exposing this legalization explicitly is needed to allow lowening 8-bit
floats on AMD GPUs, as the implementation of extf and truncf on that
platform requires the complex logic found in ArithToAMDGPU, which runs
before the GPU to ROCDL lowering.
2024-01-18 09:37:43 -06:00
Alan Phipps
22867890e4
[clang][CoverageMapping] Refactor setting MC/DC True/False Condition IDs (#78202)
Clean-up of the algorithm that assigns MC/DC True/False control-flow
condition IDs when constructing an MC/DC decision region. This patch
creates a common API for setting/getting the condition IDs, making the
binary logical operator visitor functions much cleaner.

This patch also fixes issue
https://github.com/llvm/llvm-project/issues/77873 in which a record's
control flow map can be malformed due to an incorrect calculation of the
True/False condition IDs.
2024-01-18 09:34:52 -06:00
Philip Reames
0fc5f4b524
[DAG] Set nneg flag when forming zext in demanded bits (#72281)
We do the same for the analogous transform in DAGCombine, but this case
was missed in the recent patch which added support for zext nneg.

Sorry for the lack of test coverage. Not sure how to exercise this piece
of logic. It appears to have only minimal impact on LIT tests (only
test/CodeGen/X86/wide-scalar-shift-by-byte-multiple-legalization.ll),
and even then, the changes without it appear uninteresting. Maybe we
should remove this transform instead?
2024-01-18 07:34:08 -08:00
Sergio Afonso
2747193058
[Flang][MLIR][OpenMP] Remove the early outlining interface (#78450)
After the removal of the OpenMP early outlining MLIR pass in #67319, the
`EarlyOutliningInterface` stopped doing any useful work. It used to be
necessary to tie the name of the function from which a target region was
outlined to that new function, so it would be used when translating to
LLVM IR in place of the outlined function's name.

This is not necessary anymore, so this patch removes all references to
this interface and uses of the `omp.outline_parent_name` discardable
attribute in tests.
2024-01-18 15:33:43 +00:00
Haohai Wen
fb2c6bbf42
[BranchFolding] Use isSuccessor to confirm fall through (#77923)
When merging blocks, if the previous block has no any branch instruction
and has one successor, the successor may be SEH landing pad and the
block will always raise exception and nerver fall through to next block.
We can not merge them in such case. isSuccessor should be used to
confirm it can fall through to next block.
2024-01-18 23:26:22 +08:00
Timm Baeder
819bd9e39b
[clang][Interp] IndirectMember initializers (#69900)
We need to look at the chain of declarations to initialize the right
field.
2024-01-18 16:25:05 +01:00
Alan Phipps
6d0b718e8c [Profile][CoverageMapping] MC/DC Fix passing FileID for DecisionRegion
Fixes oversight in commit 8ecbb0404d in which
FileID was not being set when creating a new MC/DC DecisionRegion.
2024-01-18 09:19:02 -06:00
madanial0
87ac65a994
[flang] Match the length size in comparison (NFC) (#78302)
The template function call CheckDescriptorEqInt((exitStat.get(), 127) is
deduced to have INT_T equal to std::int32_t instead of std::int64_t, but
the length descriptor points to a 64-byte storage. The comparison does
not work in a big endian.

Co-authored-by: Mark Danial <mark.danial@ibm.com>
2024-01-18 10:18:21 -05:00