Commit Graph

416698 Commits

Author SHA1 Message Date
Christopher Di Bella 5aaefa510e [libcxx][modules] protects users from relying on detail headers
libc++ has started splicing standard library headers into much more
fine-grained content for maintainability. It's very likely that outdated
and naive tooling (some of which is outside of LLVM's scope) will
suggest users include things such as <__ranges/access.h> instead of
<ranges>, and Hyrum's law suggests that users will eventually begin to
rely on this without the help of tooling. As such, this commit
intends to protect users from themselves, by making it a hard error for
anyone outside of the standard library to include libc++ detail headers.

Differential Revision: https://reviews.llvm.org/D106124
2022-02-26 09:00:25 +00:00
Fangrui Song 274ec425dc [test] Precisely disable flaky sanitizer tests on clang-ppc64le-redhat
See https://reviews.llvm.org/D120305#3347094
2022-02-26 07:25:44 +00:00
Craig Topper 1b1f8d6eff [SeparateConstOffsetFromGEP] Remove TargetMachine.h include. NFC
This doesn't appear to be used and it would be a layering violation
if it was.
2022-02-25 21:40:00 -08:00
Evgeniy Brevnov 10e99eb7e4 [SLP] "Normal" instructions should not go between PHI and Lading pad
Currently, SLP can insert "shuffle" instruction beween PHI and Landing pad instruction. The problem is demonstrated by LIT test. The solution is to adjust insertion point once we are done with PHI generation.

Differential Revision: https://reviews.llvm.org/D120552
2022-02-26 11:44:26 +07:00
Fangrui Song 71c4b8dfe1 [crt][test] Add -no-pie to avoid wacky linking with crt1.o if (musl || CLANG_DEFAULT_PIE_ON_LINUX)
This works with glibc crt1.o (its crt1.o is essentially Scrt1.o plus (if static
PIE is supported for the arch) _dl_relocate_static_pie) but looks wacky.

musl crt1.o is not built with an explicit -fno-pic/-fpie/-fpic. If it was built
with a non-default-pie GCC/Clang, the linker might complain about absolute
relocations referencing _init/_fini for the -pie link:

```
ld: error: relocation R_X86_64_32 cannot be used against symbol '_fini'; recompile with -fPIC
>>> defined in obj/crt/crt1.o
>>> referenced by crt1.c
>>>               obj/crt/crt1.o:(_start_c)
```
2022-02-26 04:41:49 +00:00
Joao Moreira 9d7001eba9 [ELF][X86] Don't create IBT .plt if there is no PLT entry
https://github.com/ClangBuiltLinux/linux/issues/1606
When GNU_PROPERTY_X86_FEATURE_1_IBT is enabled, ld.lld will create .plt output
section even if there is no PLT entry. Fix this by implementing
IBTPltSection::isNeeded instead of using the default code path (which always
returns true).

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D120600
2022-02-26 03:55:40 +00:00
Med Ismail Bennani 2dc6e906b0
[lldb/Host] Fix crash in FileSystem::IsLocal
This checks `m_fs` before dereferencing it to access its`isLocal` method.

rdar://67410058

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-02-25 18:33:31 -08:00
Med Ismail Bennani 425880ed35
Reland "[lldb/test] Fix TestProgressReporting.py race issue with the event listener"
This patch relands commit 3e3e79a9e4, and
fixes the memory sanitizer issue described in D120284, by removing the
output arguments from the LLDB_INSTRUMENT_VA invocation.

Differential Revision: https://reviews.llvm.org/D120599

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-02-25 17:20:39 -08:00
Med Ismail Bennani badb6e2730 [lldb/crashlog] Fix scripted_crashlog_json.test failure
This patch should fix the test failure on scripted_crashlog_json.test.

The failure is happening because crash reporter will obfuscate the
executable path in the crashlog, if it is located inside the user's
home directory and replace it with `/USER/*/` as a placeholder.

To fix that, we can patch the placeholder with the executable path
before loading the crashlog in lldb.

This also fixes a bug where we would create another target when loading
the crashlog in a scripted process, even if lldb already had a target
for it. Now, crashlog will only create a target if there is none in lldb.

Differential Revision: https://reviews.llvm.org/D120598

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-02-25 17:20:35 -08:00
Fangrui Song cb1654ee4b [Driver][test] Clean up some AIX tests
* For `-###`, `-o %t.o` is unnecessary if we don't specifically test the
  output filename.
* --target= is the canonical spelling. -target is a legacy spelling which
  unfortunately cannot be removed because there are too many uses.
* -no-canonical-prefixes uses the dereferenced absolute path for the cc1
  command. For most tests "-cc1" is sufficient to identify the command line, no
  need to specifically test the "clang" command, and -no-canonical-prefixes can
  removed.
* --unwindlib= is the preferred spelling. -u is a short option taking a value,
  which means a -uwindlib= typo cannot be detected.

I recommend that you take a look at linux-cross.cpp. Testing include paths and
library paths in one RUN line is sometimes more readable than having separate
include/library tests.

Having separate RUN lines for misc features like -fdata-sections
(`aix-data-sections.c`) is wasteful. It may be better testing multiple
options in a single RUN command.

Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D119309
2022-02-26 01:06:24 +00:00
Adrian Prantl bc7aeea854 Revert "Don't append the working directory to absolute paths"
This reverts commit 2cd9a86da5.
2022-02-25 17:00:10 -08:00
Aart Bik 8e4f8d3532 [mlir][sparse] merge ifs in new sparse rewriting rules
Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D120500
2022-02-25 15:06:47 -08:00
Aart Bik 180c9f9efe [mlir][sparse] enable scalar test
Removed TODO now that we support scalars properly

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D120590
2022-02-25 15:05:25 -08:00
Reid Kleckner f58fb8ae7f [BPF] Fix tests that fail if /tmp/t.c exists
IMO the BPF backend shouldn't read random source files referenced from
debug info. I filed llvm.org/pr54092 about this.
2022-02-25 14:55:53 -08:00
Elia Geretto 5e4b68cc3b [NewPM] Fix tests for OptimizerLast extension point
This PR fixes the tests for the `OptimizerLast` extension point in the new pass manager. The extension point uses module passes, but it was being tested with a function pass.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D120581
2022-02-25 14:49:19 -08:00
Elia Geretto 942efa5927 [NewPM] Add extension points to LTO pipeline in PassBuilder
This PR adds two extension points to the default LTO pipeline in PassBuilder, one at the beginning and one at the end. These two extension points already existed in the old pass manager, the aim is to replicate the same functionality in the new one.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D120491
2022-02-25 14:48:54 -08:00
Bixia Zheng 6f07191101 [mlir][sparse][taco] Support reduction to scalar tensors.
The PyTACO DSL doesn't support reduction to scalars. This change
enhances the MLIR-PyTACO implementation to support reduction to scalars.

Extend an existing test to show the syntax of reduction to scalars and
two methods to retrieve the scalar values.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D120572
2022-02-25 14:17:45 -08:00
Reid Kleckner 63bf228450 [Symbolizer] Move default ctor into .cpp file
Follow up to 1e396affca.  On some standard
library configurations these have a dependency on the complete type of
SymbolizableModule.
2022-02-25 14:12:15 -08:00
Amanieu d'Antras 54b909de68 [Mangler] Mangle aliases to fastcall/vectorcall functions correctly
These aliases are produced by MergeFunctions and need to be mangled according to the calling convention of the function they are pointing to instead of defaulting to the C calling convention.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D120382
2022-02-25 22:06:47 +00:00
Xiaodong Liu 1e8c9e7ac1 [Triple] Add llvm::Triple::isSPARC{,32,64}
Reviewed By: ro, MaskRay

Differential Revision: https://reviews.llvm.org/D120381
2022-02-25 21:50:34 +00:00
Martin Storsjö 0f5d0d4e82 [libcxx] Fix the error checking for wctob_l, fixing locale narrow function on Windows
According to POSIX.1 (and Glibc docs, and Microsoft docs), the wctob
function returns EOF on error, not WEOF. (And wctob_l should consequently
do the same.)

The previous misconception about what this function returns on errors
seems to stem from incorrect documentation in macOS, stemming from BSD
docs with the same issue. The corresponding documentation bug in FreeBSD
was fixed in 2012 in
945aab9099,
but it hasn't been fixed for macOS yet.

The issue seems to only be a documentation issue; the implementation
on macOS actually does use EOF, not WEOF:
https://opensource.apple.com/source/Libc/Libc-1439.40.11/locale/FreeBSD/wctob.c.auto.html

On most Unices, EOF and WEOF are the same value, but on Windows,
EOF is -1, while WEOF is (unsigned short)0xFFFF. By fixing this,
two tests start passing on Windows.

Differential Revision: https://reviews.llvm.org/D120088
2022-02-25 23:44:23 +02:00
Martin Storsjö 2d54bf3bc7 [libcxx] [test] Fix the monetary locale negative_sign test for en_US.UTF-8 on Windows
On Windows, the en_US.UTF-8 locale returns `n_sign_posn == 0`, which
means that the sign for a negative currency is parentheses around
the whole value, instead of a leading minus.

Differential Revision: https://reviews.llvm.org/D120549
2022-02-25 23:41:35 +02:00
Jonas Devlieghere 2ce6bc61e8
[lldb] Fix check for TARGET_OS_IPHONE
Instead of checking whether TARGET_OS_IPHONE is set to 1, the current
code just check the existence of TARGET_OS_IPHONE, which either always
succeeds or always fails, depending on whether you have
TargetConditionals.h included.
2022-02-25 13:24:39 -08:00
Jonas Devlieghere 03d49046b9
[dsymutil] Copy symbol table regardless of LINKEDIT segment
Ensure we copy the symbol table for MH_PRELOAD Mach-Os, which don't have
a LINKEDIT segment, but (can) have a symbol table.

rdar://88919473

Differential revision: https://reviews.llvm.org/D120583
2022-02-25 13:24:39 -08:00
Adrian Prantl bbaeb1ee0e Validate chained fixup image formats
This is part of a series of patches to upstream support for Mach-O
chained fixups.

Differential Revision: https://reviews.llvm.org/D113725
2022-02-25 13:04:00 -08:00
Adrian Prantl 2cd9a86da5 Don't append the working directory to absolute paths
This fixes a bug that happens when using -fdebug-prefix-map to remap
an absolute path to a relative path. Since the path was absolute
before remapping, it is safe to assume that concatenating the remapped
working directory would be wrong.

Differential Revision: https://reviews.llvm.org/D113718
2022-02-25 13:03:59 -08:00
owenca c05da55bdf [clang-format] Handle trailing comment for InsertBraces
Differential Revision: https://reviews.llvm.org/D120503
2022-02-25 12:29:47 -08:00
Jameson Nash d25a4b5485 Enable tests from rG8e67982384d4a11892c04d16c2d10d7533e56094 that seem to work now
I noticed randomly that the only reason these tests from
rG8e67982384d4a11892c04d16c2d10d7533e56094 seemed to still be failing is
that they are missing CHECK lines. I don't know anymore than that they
don't appear to crash or assert when I ran them today.

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D115377
2022-02-25 15:28:49 -05:00
Yaxun (Sam) Liu df0c983643 [HIP] Fix test hip-link-bundled-archive.hip
match pattern should match lld.exe on windows

Reviewed by: Shangwu Yao

Differential Revision: https://reviews.llvm.org/D120563
2022-02-25 15:27:57 -05:00
Valentin Clement a7ac120a9a
[flang] Lower logical comparison and logical operations
This handles the lowering of the logical comparison
to `arith.cmpi` operation. The logical operations `.OR.`, `.AND.`
and `.NOT.` are lowered to `arith.ori`, `arith.andi` and `arith.xori`

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D120559

Reviewed By: schweitz, rovka

Differential Revision: https://reviews.llvm.org/D120560

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2022-02-25 21:05:44 +01:00
Valentin Clement 98813e365c
[flang] Lower real comparison operations
This patch handles the lowering of real
comparison operations. The real comparison operations
are lowered to `arith.cmpf` operation.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld, schweitz

Differential Revision: https://reviews.llvm.org/D120561

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2022-02-25 21:03:39 +01:00
Valentin Clement f1dcf3ae92
[flang] Lower integer comparison operation
This patch handles the lowering of comprison
operator between integers.
The comparison is lowered to a `arith.cmpi` operation.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld, schweitz, rovka

Differential Revision: https://reviews.llvm.org/D120559

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2022-02-25 21:01:27 +01:00
Fangrui Song 84647ff38c [libunwind][test] remember_state_leak.pass.sh.s: link with -no-pie
The no-pic large code model style `movabsq $callback, %rsi` does not work with -pie.
2022-02-25 19:55:56 +00:00
Hanhan Wang 748bf4bb28 [mlir][Linalg] Add support for tileFuseAndDistribute on tensors.
This extends TileAndFuse to handle distribution on tensors.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D120441
2022-02-25 11:51:11 -08:00
Craig Topper 5e33bd804b [RISCV] Remove tab character from test. Autogenerate CHECK lines. NFC
This was a test for an infinite loop so the CHECK lines don't really
matter, but they'd get generated the next time someone runs the script
on the file so might as well do it while I'm touching it.
2022-02-25 11:37:27 -08:00
Jameson Nash c4b1a63a1b mark getTargetTransformInfo and getTargetIRAnalysis as const
Seems like this can be const, since Passes shouldn't modify it.

Reviewed By: wsmoses

Differential Revision: https://reviews.llvm.org/D120518
2022-02-25 14:30:44 -05:00
Diego Caballero 875bbce9f7 [mlir][Vector] Prevent AVX2 lowering for non-f32 transpose ops
The AVX2 lowering for transpose operations is only applicable to f32 vector types.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D120427
2022-02-25 19:27:32 +00:00
Diego Caballero d7e0a0846b [mlir][Vector] Generalize AVX2 transpose lowering to n-D vectors
The existing AVX2 lowering patterns for the transpose op only triggers if the
input vector is 2-D. This patch extends the patterns to trigger for n-D vectors
which are effectively 2-D vectors (e.g., vector<1x4x1x8x1). The main constraint
for the generalized AVX2 patterns to be applicable to these vectors is that the
dimensions that are greater than one must be transposed. Otherwise, the existing
patterns are not applicable.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D119505
2022-02-25 19:27:32 +00:00
Fangrui Song 767e64fc11 [ELF] Support some absolute/PC-relative relocation types for REL format
ctfconvert seems to use REL-format `.rel.SUNW_dof` for 32-bit architectures.
```
Binary file usr/ports/lang/perl5.32/work/perl-5.32.1/dtrace_mini.o matches
[alfredo.junior@dell-a ~/tmp/llvm-bug]$ readelf -r dtrace_mini.o

Relocation section (.rel.SUNW_dof):
r_offset r_info   r_type              st_value st_name
00000184 0000281a R_PPC_REL32         00000000 $dtrace1772974259.Perl_dtrace_probe_load
```

Support R_PPC_REL32 to fix `ld.lld: error: drti.c:(.SUNW_dof+0x4E4): internal linker error: cannot read addend for relocation R_PPC_REL32`.
While here, add some common relocation types for AArch64, PPC, and PPC64.
We perform minimum tests.

Reviewed By: adalava, arichardson

Differential Revision: https://reviews.llvm.org/D120535
2022-02-25 19:25:18 +00:00
Chia-hung Duan 9445b39673 [mlir] Support verification order (2/3)
This change gives explicit order of verifier execution and adds
    `hasRegionVerifier` and `verifyWithRegions` to increase the granularity
    of verifier classification. The orders are as below,

    1. InternalOpTrait will be verified first, they can be run independently.
    2. `verifyInvariants` which is constructed by ODS, it verifies the type,
       attributes, .etc.
    3. Other Traits/Interfaces that have marked their verifier as
       `verifyTrait` or `verifyWithRegions=0`.
    4. Custom verifier which is defined in the op and has marked
       `hasVerifier=1`

    If an operation has regions, then it may have the second phase,

    5. Traits/Interfaces that have marked their verifier as
       `verifyRegionTrait` or
       `verifyWithRegions=1`. This implies the verifier needs to access the
       operations in its regions.
    6. Custom verifier which is defined in the op and has marked
       `hasRegionVerifier=1`

    Note that the second phase will be run after the operations in the
    region are verified. Based on the verification order, you will be able to
    avoid verifying duplicate things.

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D116789
2022-02-25 19:04:56 +00:00
Alexey Bataev d04d9220e1 [OPENMP]Fix PR50347: Mapping of global scope deep object fails.
Changed the we handle llvm::Constants in sizes arrays. ConstExprs and
GlobalValues cannot be used as initializers, need to put them at the
runtime, otherwise there wight be the compilation errors.

Differential Revision: https://reviews.llvm.org/D105297
2022-02-25 10:54:24 -08:00
Fangrui Song a8ddd4cc45 Revert "[lsan][test] Temporarily disable ppc64 and ppc64le to appease clang-ppc64le-rhel"
This reverts commit cb76c4d71c.

The failures were in test/sanitizer_common, not in test/lsan.
2022-02-25 18:50:39 +00:00
Fangrui Song d3d73cabc1 [compiler-rt][test] Temporarily disable ppc64 and ppc64le test/sanitizer_common and test/crt
to appease clang-ppc64le-rhel: https://github.com/llvm/llvm-project/issues/54084
2022-02-25 18:49:10 +00:00
Changpeng Fang ca62b1db9f [AMDGPU][NFC]: Emit metadata for hidden_heap_v1 kernarg
Summary:
  Emit metadata for hidden_heap_v1 kernarg

Reviewers:
  sameerds, b-sumner

Fixes:
  SWDEV-307188

Differential Revision:
  https://reviews.llvm.org/D119027
2022-02-25 10:45:35 -08:00
Alexander Yermolovich a44fe31977 [BOLT][DWARF] Fix how DW_AT_high_pc [DW_FORM_udata] is handled
We were not handling correctly conversion from DW_AT_high_pc into DW_AT_ranges,
when size of DW_AT_high_pc is not 4/8 bytes.

Reviewed By: maksfb

Differential Revision: https://reviews.llvm.org/D120528
2022-02-25 10:32:05 -08:00
Fangrui Song cb76c4d71c [lsan][test] Temporarily disable ppc64 and ppc64le to appease clang-ppc64le-rhel
Seems that ppc64 lsan doesn't work with default PIE (see D120305):
https://lab.llvm.org/buildbot/#/builders/57/builds/15506
2022-02-25 18:25:45 +00:00
Arthur Eubanks 18da681034 [NFC] Remove unnecessary function pass managers 2022-02-25 10:03:17 -08:00
Florian Hahn c679fbee2a
[AArch64] Add tests for tbl + cmp splitting.
Additional tests showing potential for follow-ups after
D120571.
2022-02-25 17:59:44 +00:00
Kiran Chandramohan 7c0acc1a98 Lower Fortran intrinsic to a runtime call/llvm intrinsic
This patch brings in code which can lower a Fortran intrinsic to
a runtime call or an llvm intrinsic. For math intrinsics the
runtime call is to the `math` or `pgmath` library. Non-math
intrinsics are covered by the Flang runtime. A distance computation
mechanism is introduced to find the runtime function that closely
matches the types of the intrinsic call.

In this patch, the `abs` intrinsic is lowered in the following way,
-> Integer version is lowered as a group of MLIR/FIR operations
-> Real version is lowered to llvm intrinsics
-> Complex version is lowered to the `math_hypot` runtime function

This patch is part of upstreaming from the fir-dev branch of https://github.com/flang-compiler/f18-llvm-project

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D120403

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: zacharyselk <zrselk@gmail.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
2022-02-25 17:41:48 +00:00
Rong Xu ccbbb4f6c7 [Sample-PGO] Emit FS discriminators only when -fdebug-info-for-profiling is set
IR level addDiscriminator pass is guarded by DebugInfoForProfiling
(set by option -fdebug-info-for-profiling).
This patch syncs the logic for the MIR and IR level implementations.

Differential Revision: https://reviews.llvm.org/D120536
2022-02-25 09:41:17 -08:00