Commit Graph

433855 Commits

Author SHA1 Message Date
owenca 2e36120726 [clang-format] Fix regressions in WhitespaceSensitiveMacros
Fixes #54522.
Fixes #57158.

Differential Revision: https://reviews.llvm.org/D132001
2022-08-22 20:42:54 -07:00
Stanley Winata f148f3b2e9 [mlir][spirv] Use spv.store instead of init in var
- Add spv.store instead of init for spv.variable to fix data issues in
  some GPU drivers

Reviewed By: antiagainst
Patch By: raikonenfnu

Differential Revision: https://reviews.llvm.org/D132427
2022-08-22 23:41:27 -04:00
Stanley Winata 23f0d78284 [mlir][spirv] Add vector.fma lowering to CL.fma
Reviewed By: antiagainst
Patch By: raikonenfnu

Differential Revision: https://reviews.llvm.org/D132424
2022-08-22 23:36:07 -04:00
Phoebe Wang 08388ad81e [X86][AVX512FP16] Relax limitation to AVX512FP16 intrinsics. NFCI
Since we have enabled the support for `_Float16` on SSE2, we can relax
the limitation for AVX512FP16 now. This helps for user to use AVX512FP16
mixed with unsupported versions, e.g., multiversioning.

Also fix lit fails due to missing const modifier. Found during this change.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D132342
2022-08-23 11:35:16 +08:00
Chenbing Zheng 6b3cbf60f4 [InstCombine] add tests for shuf bitcast. nfc 2022-08-23 11:01:18 +08:00
Nico Weber 4a2c8dcc17 [gn build] port e78208f082 2022-08-22 21:46:36 -04:00
Jan Svoboda be795ee16a [clang][deps] Allow switching between lazily/eagerly loaded PCMs
This patch introduces new option `-eager-load-pcm` to `clang-scan-deps`, which controls whether the resulting command-lines will load PCM files eagerly (at the start of compilation) or lazily (when handling import directive). This patch also switches the default from eager to lazy.

To reduce the potential for churn in LIT tests in the future, this patch also removes redundant checks of command-line arguments and introduces new test `modules-dep-args.c` as a substitute.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D132066
2022-08-22 18:22:27 -07:00
Dave Lee 987d5e6c6c [llvm][utils] Make lldb data formatters show both summaries and children
When a type has a summary and synthetic child provider, the children are shown
only if `--expand`/`-e` is given.

This updates `lldbDataFormatters.py` to expand children of types that have both
a summary and synthetic children.

Differential Revision: https://reviews.llvm.org/D132095
2022-08-22 18:08:53 -07:00
jackalcooper ff9aab7572 [mlir][vulkan-runner] Use aligned pointer for host buffer
Fix incorrect pointer usage in Vulkan buffer and Memref descriptor binding:
- Vulkan runtime produced incorrect result if there is alignment.
- There was illegal memory access if binding a LLVM global materialized
  from a constant op (0xdeadbeef).

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D132291
2022-08-22 20:42:54 -04:00
Jacques Pienaar 7d273fde11 [mlir] Populate default attributes on op creation
Default attributes were only handled by ODS accessors generated with the
intention that these behave as if set attributes. This addresses the
long standing TODO to address this inconsistency. Moving the
initialization to construction vs every access. Removing need for
duplicated default attribute population in python bindings.

Switch some of the OpenMP ones to optional attribute with default as the
currently set default values are not legal. May need to dig more there.

Switched LinAlg generated ones to optional attribute with default as its
quite widely used and unclear where it falls on two different
interpretations.

Differential Revision: https://reviews.llvm.org/D130916
2022-08-22 16:49:46 -07:00
Akira Hatanaka 0d66dc57e8 Revert "[compiler-rt][builtins] Add compiler flags to catch potential errors"
This reverts commit 5f886adbfd.

It broke clang-hip-vega20.

https://lab.llvm.org/buildbot/#/builders/165/builds/23675
2022-08-22 16:39:15 -07:00
Yuanfang Chen e78208f082 [compiler-rt][lit] initialize LIT LLVMConfig instance
to handle lit tools searching. Otherwise
compiler-rt depends on system environment variable PATH for lit tools
which diverge from the other LLVM projects. This reverts D83486 which
really should be implemented in LIT itself when the PATH is constructed.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D122837
2022-08-22 16:36:39 -07:00
Akira Hatanaka 5f886adbfd [compiler-rt][builtins] Add compiler flags to catch potential errors
that can lead to security vulnerabilities

Also, fix a few places that were causing -Wshadow and
-Wformat-nonliteral warnings to be emitted.

Differential Revision: https://reviews.llvm.org/D131714
2022-08-22 16:27:22 -07:00
Siva Chandra Reddy 3496dd3bb6 [libc][Obvious] Move some macros definitions to sys/stat.h.
They were previously incorrectly listed in fcntl.h
2022-08-22 23:19:18 +00:00
Christopher Di Bella e137fb6fb8 [clang][libcxx] renames `__remove_reference`
libc++ prior to LLVM 15 has a bug in it due to it excluding
`remove_reference_t` when `__remove_reference` is available as a
compiler built-in. This went unnoticed until D116203 because it wasn't
available in any compiler.

To work around this, we're renaming `__remove_reference` to
`__remove_reference_t`.

TEST=Tested locally, tested using emscripten
2022-08-22 23:15:10 +00:00
Keith Smiley d991aa91f1
[llvm-objcopy][MachO] Remove more sections with llvm-bitcode-strip
This adds the other potential bitcode sections that can exist and should
be stripped with `-r` from `llvm-bitcode-strip`.

Differential Revision: https://reviews.llvm.org/D132267
2022-08-22 16:08:58 -07:00
Andrew Browne 065d2e1d8b [DFSan] Fix handling of libAtomic external functions.
Implementation based on MSan.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D132070
2022-08-22 16:04:29 -07:00
Yuanfang Chen f9969a3d28 [CodeGen] Sort llvm.global_ctors by lexing order before emission
Fixes https://github.com/llvm/llvm-project/issues/55804

The lexing order is already bookkept in DelayedCXXInitPosition but we
were not using it based on the wrong assumption that inline variable is
unordered. This patch fixes it by ordering entries in llvm.global_ctors
by orders in DelayedCXXInitPosition.

for llvm.global_ctors entries without a lexing order, ordering them by
the insertion order.

(This *mostly* orders the template instantiation in
https://reviews.llvm.org/D126341 intuitively, minus one tweak for which I'll
submit a separate patch.)

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D127233
2022-08-22 16:00:14 -07:00
Dave Lee c21dfa9e49 [lldb] Remove prefer-dynamic-value test override
Remove the test override of `target.prefer-dynamic-value`.

Previously, the lldb default was `no-dynamic-values`. In rG9aa7e8e9ffbe (in
2015), the default was changed to `no-run-target`, but at that time the tests
were changed to be run with `no-dynamic-value`. I don't know the reasons for
not changing the tests, perhaps to avoid determining which tests to change, and
what about them to change.

Because `no-run-target` is the lldb default, I think it makes sense to make it
the test default too. It puts the test config closer to what's used in
practice.

This change removes the `target.prefer-dynamic-value` override, and for those
tests that failed, they have been updated to explicitly use
`no-dynamic-values`. Future changes could update these tests to use dynamic
values too, or they can be left as is to exercise non-dynamic typing.

Differential Revision: https://reviews.llvm.org/D132382
2022-08-22 15:46:03 -07:00
Jacques Pienaar b1f2e2664e [mlir][tosa] Switch TosaFoldConstantTranspose to use ElementsAttr.
Also avoid redoing index calculation.

Differential Revision: https://reviews.llvm.org/D132274
2022-08-22 15:45:23 -07:00
Yaxun (Sam) Liu 9f6cb3e9fd [AMDGPU] Add builtin s_sendmsg_rtn
Reviewed by: Brian Sumner, Artem Belevich

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

Fixes: SWDEV-352017
2022-08-22 18:29:23 -04:00
Chris Bieneman eebf84c5b3 [DirectX] Remove broken assert
This assert always fails. It is unclear to me what it was attempting to
test, but removing it gets our tests passing, so it clearly isn't
checking the right thing.
2022-08-22 17:25:16 -05:00
Philip Reames 104fa367ee [TTI] Use OperandValueInfo in getArithmeticInstrCost implementation [NFC]
This change completes the process of replacing OperandValueKind and OperandValueProperties which were previously passed independently in this API with a single container class which contains both.

This is the change which motivated the whole sequence which preceeded it.  In an original spike version of this change, I'd noticed a nasty bug: I'd changed the signature without changing names, and as result, we silently passed additional information through a callsite which previously dropped the power-of-two fact.  This might be harmless in most cases, but at least a couple clearly dependend for correctness on not passing that property through.

I did my best to split off prior changes which reduced the scope of this one, and which made it possible to use compiler assistance.  For instance, every parameter which changes type in this change also changes name.  This was intentional to make sure that every call site possible effected must show up in the diff.  This let me audit each one closely.
2022-08-22 15:16:39 -07:00
Jacques Pienaar af29db64b2 [mlir][shape] refine shape.func and shape.with_shape
- shape.with_shape supports ExtentTensorType
- add helper to create shape.func

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D131977
2022-08-22 14:52:18 -07:00
Greg Clayton ae376feb0b Modify all register values whose byte size matches the address size to be formatter as eFormatAddressInfo.
This allows users to see similar output to what the "register read" command emits in LLDB's command line.

Added a test to verify that the PC has the correct value with contains a pointer followed by the module + function name and the source line info. Something like:

0x0000000100000a64 a.out`main + 132 at main.cpp:17:11

Differential Revision: https://reviews.llvm.org/D129528
2022-08-22 14:48:16 -07:00
Greg Clayton f0697d7c3f Don't create sections for SHN_ABS symbols in ELF files.
Symbols that have the section index of SHN_ABS were previously creating extra top level sections that contained the value of the symbol as if the symbol's value was an address. As far as I can tell, these symbol's values are not addresses, even if they do have a size. To make matters worse, adding these extra sections can stop address lookups from succeeding if the symbol's value + size overlaps with an existing section as these sections get mapped into memory when the image is loaded by the dynamic loader. This can cause stack frames to appear empty as the address lookup fails completely.

This patch:
- doesn't create a section for any SHN_ABS symbols
- makes symbols that are absolute have values that are not addresses
- add accessors to SBSymbol to get the value and size of a symbol as raw integers. Prevoiusly there was no way to access a symbol's value from a SBSymbol because the only accessors were:

  SBAddress SBSymbol::GetStartAddress();
  SBAddress SBSymbol::GetEndAddress();

  and these accessors would return an invalid SBAddress if the symbol's value wasn't an address
- Adds a test to ensure no ".absolute.<symbol-name>" sections are created
- Adds a test to test the new SBSymbol APIs

Differential Revision: https://reviews.llvm.org/D131705
2022-08-22 14:46:27 -07:00
Sanjay Patel 2880d7b9e4 [InstCombine] add tests for mul+add common factor; NFC 2022-08-22 17:19:45 -04:00
Chris Bieneman 9a478d5232 [NFC] Rename dx.shader to hlsl.shader
This metadata annotation is HLSL-specific not DirectX specific. It will
need to be attached for shaders regardless of whether they are targeting
DXIL.
2022-08-22 16:03:40 -05:00
Philip Reames 478cf94378 [X86][AArch64][WebAsm][RISCV] Query operand properties instead of using enums directly [nfc]
This is part of an ongoing transition to use OperandValueInfo which combines OperandValueKind and OperandValueProperties.  This change adds some accessor methods and uses them to simplify backend code.  The primary motivation of doing so is removing uses of the parameters so that an upcoming api change is less error prone.
2022-08-22 13:37:59 -07:00
Philip Reames 5e87a020a5 [X86][TTI] Rename OpNInfo to OpNKind [nfc]
Both are reasonable names; this is solely that an upcoming change can use the OpNInfo name, and the compiler can tell me if I forgot to update something (instead of silently passing along properties that might not hold.)
2022-08-22 13:37:59 -07:00
Alan Zhao 8c8cfaaf0a Revert "[ARM] Use getSymbolPreferLocal() in GetARMGVSymbol"
This reverts commit 6db15a82cc.

Reverted because this breaks offical Chrome builds targeting Android on
arm: https://crbug.com/1354305

Repro: https://drive.google.com/file/d/1pgQI2adwx3DJJqIYvMY4i249ouHU0rmu/view?usp=sharing
2022-08-22 16:16:37 -04:00
David Majnemer 0bf525bf90 [clang-cl] Add _M_FP_* #defines for floating point modes
This keeps clang compatible with MSVC defines for the FP environment.
These defines are used by the CRT and other libraries to interrogate
what to expect. Perhaps most importantly, they feed into the definition
of float_t and double_t which may result in ODR violations between MSVC
and clang.
2022-08-22 20:04:35 +00:00
Shoaib Meenai 491a5c9570 [MachO] Fix formatting. NFC
The style guide says that all arms of an if-else should have braces if
any arm does [1].

[1] https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
2022-08-22 23:00:07 +03:00
Stephen Tozer 5fa6e8c3ed [InstrRef] Fix unused variable in InstrRefLDVTest 2022-08-22 20:52:47 +01:00
Stephen Tozer 53fd5af689 [DebugInfo] Let InstrRefBasedLDV handle joins for lists of debug ops
In preparation for adding support for DBG_VALUE_LIST instructions in
InstrRefLDV, this patch updates the logic for joining variables at block
joins to support joining variables that use multiple debug operands.
This is one of the more meaty "logical" changes, although the line count
isn't too high - this changes pickVPHILoc to find a valid joined
location for every operand, with part of the function being split off
into pickValuePHILoc which finds a location for a single operand.

Differential Revision: https://reviews.llvm.org/D128180
2022-08-22 20:22:22 +01:00
Akira Hatanaka 5d794552bc [Sema][ObjC] Don't warn about implicitly-retained self in an unevaluated
context
2022-08-22 12:16:37 -07:00
David Penry ced705c440 [ModuloSchedule] Add interface call to accept/reject SMS schedules
This interface allows a target to reject a proposed
SMS schedule.  For Hexagon/PowerPC, all schedules
are accepted, leaving behavior unchanged.  For ARM,
schedules which exceed register pressure limits are
rejected.

Also, two RegisterPressureTracker methods now need to be public so
that register pressure can be computed by more callers.

Reapplication of D128941/(reversion:D132037) with small fix.

Differential Revision: https://reviews.llvm.org/D132170
2022-08-22 12:10:13 -07:00
Jay Foad f82c55fa08 [InstCombine] Change order of canonicalization of ADD and AND
Canonicalize ((x + C1) & C2) --> ((x & C2) + C1) for suitable constants
C1 and C2, instead of the other way round. This should allow more
constant ADDs to be matched as part of addressing modes for loads and
stores.

Differential Revision: https://reviews.llvm.org/D130080
2022-08-22 20:03:53 +01:00
Jay Foad 2754ff883d [InstCombine] Try not to demand low order bits for Add
Don't demand low order bits from the LHS of an Add if:
- they are not demanded in the result, and
- they are known to be zero in the RHS, so they can't possibly
  overflow and affect higher bit positions

This is intended to avoid a regression from a future patch to change
the order of canonicalization of ADD and AND.

Differential Revision: https://reviews.llvm.org/D130075
2022-08-22 20:03:53 +01:00
Jay Foad 8b24e64014 [InstCombine] Add tests for D130075
Differential Revision: https://reviews.llvm.org/D132381
2022-08-22 20:03:52 +01:00
Vitaly Buka d848186a3b [tsan] Keep thread/stack for closed FD
Fixes b/242869837

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D132068
2022-08-22 12:00:52 -07:00
David Majnemer 3d89323d18 [clang-cl] Increase /fp flag fidelity
They were mapped as follows:
- /fp:except to --ftrapping-math
- /fp:except- to --fno-trapping-math
- /fp:strict to --fno-fast-math
- /fp:precise to --fno-fast-math

Let's map them as follows:
- /fp:except to --ffp-exception-behavior=strict
- /fp:except- to --ffp-exception-behavior=ignore
- /fp:strict to --ffp-model=strict
- /fp:precise to --ffp-model=ignore

I believe the changes to /fp:except are technically a no-op but it makes
the mapping a lot clearer. The changes for /fp:strict and /fp:precise are not
no-ops, they now match MSVC's behavior.

While we are here, also add support for /fp:contract by mapping it to
-ffp-contract=on.
2022-08-22 18:32:58 +00:00
Philip Reames 27d3321c4f [TTI] Use OperandValueInfo in getMemoryOpCost client api [nfc]
This removes the last use of OperandValueKind from the client side API, and (once this is fully plumbed through TTI implementation) allow use of the same properties in store costing as arithmetic costing.
2022-08-22 11:26:31 -07:00
Kazu Hirata 71771f8510 [CodeGen] Fix unused variable warnings 2022-08-22 11:11:30 -07:00
Usman Nadeem ef5ede52ef [Flang][Driver] Add support for PIC
This patch does the following:

 - Consumes the PIC flags (fPIC/fPIE/fropi/frwpi etc) in flang-new.
   tools::ParsePICArgs() in ToolChains/CommonArgs.cpp is used for this.
 - Adds FC1Option to "-mrelocation-model", "-pic-level", and "-pic-is-pie"
   command line options.
 - Adds the above options to flang/Frontend/CodeGenOptions' data structure.
 - Sets the relocation model in the target machine, and
 - Sets module flags for the respective PIC/PIE type in LLVM IR.

I have tried my best to replicate how clang does things.

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

Change-Id: I68fe64910be28147dc5617826641cea71b92d94d
2022-08-22 11:10:42 -07:00
Philip Reames 274f86e7a6 [TTI] Remove OperandValueKind/Properties from getArithmeticInstrCost interface [nfc]
This completes the client side transition to the OperandValueInfo version of this routine.  Backend TTI implementations still use the prior versions for now.
2022-08-22 11:06:32 -07:00
Nemanja Ivanovic 8537a99b2c [GTest] Change detection of libpthread
We currently use CMake's find_library function to detect whether
libpthread exists on the system to determine if pthread should
be added on the link step. However, there are configurations in
which CMake's path checking fails to find the library even though
the toolchain has it.

One such case is with Clang 14.0.0 on PowerPC. Due to a recent
change, the build puts libc++ and related libraries in a
subdirectory that appears to depend on the default target triple.
CMake then uses that subdirectory to determine the architecture
and adds that name to its search paths. However, the triple for
the system GNU toolchain is different so CMake fails to find it.
Namely, Clang 14.0.0's default target triple and the subdirectory
name is powerpc64le-unknown-linux-gnu whereas the system GNU
toolchain has powerpc64le-linux-gnu. Clang's driver has no trouble
finding either the GNU includes/libraries or Clang's own. But
CMake seems to get this wrong.

The net result of this is that we can't do a shared libraries
build of ToT with Clang 14.0.0.

This patch proposes using HAVE_LIBPTHREAD which CMake seems to
determine by compiling a test file with -lpthread (or perhaps
-pthread, I can't really get CMake to tell me how it is figuring
this out). If that variable tells CMake that the build compiler
accepts the pthread option, it seems reasonable to depend on
that variable to determine if we should add it to the link step
when building the llvm_gtest library.
2022-08-22 13:05:40 -05:00
Kazu Hirata 36ec4deca5 [LiveDebugValues] Fix a warning
This patch fixes:

  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:330:5: error:
  anonymous types declared in an anonymous union are an extension
  [-Werror,-Wnested-anon-types]
2022-08-22 10:57:16 -07:00
Mike Rice 129904d504 [OpenMP][NFC] Use OMPInteropInfo in the OMPDeclareVariantAttr attribute
In preparation for allowing the prefer_type list in the append_args clause,
use the OMPInteropInfo in the attribute for 'declare variant'.

This requires adding a new Argument kind to the attribute code. This change
adds a specific attribute to pass an array of OMPInteropInfo. It implements
new tablegen needed to handle the interop-type part of the structure. When
prefer_type is added, more work will be needed to dump, instantiate, and
serialize the PreferTypes field in OMPInteropInfo.

Differential Revision: https://reviews.llvm.org/D132270
2022-08-22 10:41:16 -07:00
Tarun Prabhu 2f2fce8eaa [flang] Fold F08 parity intrinsic
Perform compile-time folding of the F08 parity intrinsic when all parameters are compile-time constants.

Differential Revision: https://reviews.llvm.org/D129785
2022-08-22 11:29:45 -06:00