Shilei Tian [Sun, 23 Jul 2023 22:35:38 +0000 (18:35 -0400)]
[OpenMP] Introduce kernel environment
This patch introduces per kernel environment. Previously, flags such as execution mode are set through global variables with name like `__kernel_name_exec_mode`. They are accessible on the host by reading the corresponding global variable, but not from the device. Besides, some assumptions, such as no nested parallelism, are not per kernel basis, preventing us applying per kernel optimization in the device runtime.
This is a combination and refinement of patch series D116908, D116909, and D116910.
Depend on D155886.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D142569
Fangrui Song [Sun, 23 Jul 2023 22:15:05 +0000 (15:15 -0700)]
[X86] Fix a typo of Broadwell after D74918. NFC
Close #64053
Fangrui Song [Sun, 23 Jul 2023 22:06:33 +0000 (15:06 -0700)]
ReleaseNotes: add lld/ELF notes
Shilei Tian [Sun, 23 Jul 2023 21:40:52 +0000 (17:40 -0400)]
[OpenMP][Plugin] Update the global address calculation
Current global address caculation doesn't work for AMDGPU in some cases (https://reviews.llvm.org/D142569#4506212).
The root cause is the `sh_addr` is not substracted when caculating the address.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D155886
Andrzej Warzynski [Sun, 23 Jul 2023 21:05:47 +0000 (23:05 +0200)]
[mlir][docs][nfc] Fix markdown link
Shivam Gupta [Sun, 23 Jul 2023 18:11:39 +0000 (23:41 +0530)]
[clang-tidy] performance-* checks: Also allow allow member expressions to be used in a const manner.
Until now when determining all the const uses of a VarDecl we only considered
how the variable itself was used. This change extends checking for const usages
of the type's members as well.
This increases the number of true positives for various performance checks that
share the same const usage analysis.
Path by Felix Berger
Reviewed By: njames93, PiotrZSL
Differential Revision: https://reviews.llvm.org/D97567
David Green [Sun, 23 Jul 2023 18:17:11 +0000 (19:17 +0100)]
[AArch64] Lower fcvtl2 (fpext) via tablegen patterns.
This patch does two things. First it removes the tryHighFPExt DAG2DAG method
used to select fcvtl2 instructions, using tablegen patterns through
SelectExtractHigh instead. This essentially undoes D71515, in a way that should
hopefully avoid any regressions. The second is that a GI equivalent of
SelectExtractHigh is added in selectExtractHigh, from G_UNMERGE_VALUES. The
end result is that GlobalISel (and some constrained fpext) can now make use of
the fcvtl2 instructions, saving an extra dup/ext.
Differential Revision: https://reviews.llvm.org/D155871
Piotr Zegar [Sun, 23 Jul 2023 18:12:47 +0000 (18:12 +0000)]
Revert "[clang-tidy] Add bugprone-empty-catch check"
CI failed on "ubuntu-fast" due to disabled exceptions.
This reverts commit
f256fee5343033bf8a31aee06a80f3e982b76f82.
LLVM GN Syncbot [Sun, 23 Jul 2023 18:04:35 +0000 (18:04 +0000)]
[gn build] Port
f256fee53430
Piotr Zegar [Sun, 23 Jul 2023 18:02:03 +0000 (18:02 +0000)]
[clang-tidy] Add bugprone-empty-catch check
Detects and suggests addressing issues with empty catch statements.
Reviewed By: xgupta
Differential Revision: https://reviews.llvm.org/D144748
Simon Pilgrim [Sun, 23 Jul 2023 17:41:12 +0000 (18:41 +0100)]
[X86] IsEligibleForTailCallOptimization - use for-range loops where possible. NFCI.
Noah Goldstein [Sun, 23 Jul 2023 16:26:20 +0000 (11:26 -0500)]
[InstCombine] Fix bug in canonicalization of Pow2 Tests (From: D152673)
D152673 Incorrectly didn't account for operand position in the `icmp`,
i.e it treated `icmp uge x, y` the same as `icmp uge y, x` which is
incorrect:
https://reviews.llvm.org/rG142f7448e770f25b774b058a7eab1f107c4daad9
The fix takes operand position into account. The new tests
exhaustively cover all operand positions for `ule`, `uge`, `ult`,
`ugt` (the set of predicates) and all transform verify with the new
commit.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D156058
David Green [Sun, 23 Jul 2023 15:58:13 +0000 (16:58 +0100)]
[AArch64][GISel] Additional FPExt vector lowering
Similar to D155311, this adds lowering for more vector cases for FPExt
Differential Revision: https://reviews.llvm.org/D155601
Maksim Panchenko [Sat, 22 Jul 2023 02:14:26 +0000 (19:14 -0700)]
[BOLT] Fix jump table issue for split functions
A jump table in a split function may contain an entry matching a start
address of another fragment of the function. While converting addresses
to labels, we used to ignore such entries resulting in underpopulated
jump table. Change that, so we always create one label per address.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D156013
Nuno Lopes [Sun, 23 Jul 2023 14:57:21 +0000 (15:57 +0100)]
[LSR] Use poison instead of undef as placeholder [NFC]
This value is patcher afterwards, and only used temporarily during dbg info construction
Simon Pilgrim [Sun, 23 Jul 2023 14:49:22 +0000 (15:49 +0100)]
[X86] getIntImmCostInst - avoid repeating getNumOperands() in for-loop (style). NFC.
Simon Pilgrim [Sun, 23 Jul 2023 14:45:10 +0000 (15:45 +0100)]
[X86] getIntImmCostInst - silence static analyzer overflow warning. NFCI.
Use the divideCeil uint64_t return type directly
Nuno Lopes [Sun, 23 Jul 2023 14:02:23 +0000 (15:02 +0100)]
[Scalarizer] Fold -1 mask in shufflevector to poison instead of undef
Per latest LangRef
Shivam Gupta [Sun, 23 Jul 2023 13:53:32 +0000 (19:23 +0530)]
[clang-tidy][clang-tidy-diff.py] Change shebang from python to python3
Phoebe Wang [Sun, 23 Jul 2023 12:29:54 +0000 (20:29 +0800)]
[X86][FP16] Split v32f16 shuffle when feature BWI is off
Found this problem when investigating #63017
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D156050
Piotr Zegar [Sun, 23 Jul 2023 12:29:18 +0000 (12:29 +0000)]
[clang-tidy][NFC] Fix links to fuchsia codding standard
Correct links to fuchsia codding standard in
documentation for fuchsia-* checks.
Partially fixes: #62334
Simon Pilgrim [Sun, 23 Jul 2023 11:21:39 +0000 (12:21 +0100)]
[X86] lowerRegToMasks - rename masklen -> MaskLenVT. NFC.
Fixes style warning
Antonio Frighetto [Sun, 23 Jul 2023 11:25:14 +0000 (11:25 +0000)]
[InstCombine] Regenerate test checks (NFC)
Antonio Frighetto [Sun, 23 Jul 2023 10:52:47 +0000 (10:52 +0000)]
[InstCombine] Do not assume scalar types in `select`/`zext`
Do not assume scalar types when folding binops of `select`
operations and `zext`/`sext` of their condition.
Reported-by: Benjins, dyung
Proofs: https://alive2.llvm.org/ce/z/GmDLns
Simon Pilgrim [Sun, 23 Jul 2023 10:53:35 +0000 (11:53 +0100)]
[X86] X86ISelLowering.cpp - fix some mixed case SDLoc variable names. NFC.
Consistently use SDLoc DL
Simon Pilgrim [Sun, 23 Jul 2023 10:11:57 +0000 (11:11 +0100)]
Add missing 'namespace X86' closing comment to appease static analyser. NFC.
Simon Pilgrim [Sat, 22 Jul 2023 21:12:49 +0000 (22:12 +0100)]
[X86] LowerFunnelShift - manually expand funnel shifts by splat constant patterns.
Followup to
af32e51a43fb4343f - where the undef funnel shift amounts (during widening from v2i32 -> v4i32) were being constant folded to 0 when the shift amounts are created during expansion, losing the splat'd shift amounts.
Simon Pilgrim [Sat, 22 Jul 2023 17:47:11 +0000 (18:47 +0100)]
[X86] Add basic test coverage for funnels shifts of sub-128-bit vector types
Corentin Jabot [Sun, 23 Jul 2023 09:09:43 +0000 (11:09 +0200)]
[Clang][NFC] Restore changelog entry incorrectly removed by
02bb2beeef
Amirreza Ashouri [Sun, 23 Jul 2023 08:40:48 +0000 (10:40 +0200)]
[clang] Fix diagnostics for defaulted, implicitly deleted 'operator=='.
https://godbolt.org/z/cMKE3o1aG
According to the issue https://github.com/llvm/llvm-project/issues/63960 , compiler falsely complains that no viable `operator<=>` was found while we are actually looking for a `operator==`.
This bug has been fixed through adding a check of the `OverloadedOperatorKind` type's object, `OO`, to see if it is `OO_EqualEqual` in addition to `OO_ExclaimEqual`.
Reviewed By: #clang-language-wg, cor3ntin
Differential Revision: https://reviews.llvm.org/D155714
Timm Bäder [Sat, 22 Jul 2023 11:29:54 +0000 (13:29 +0200)]
[clang][Interp][NFC] Fix two small code style problems
Timm Bäder [Sat, 22 Jul 2023 11:08:55 +0000 (13:08 +0200)]
[clang][Interp][NFC] Fix InterpStack::dump() for empty stacks
Timm Bäder [Sun, 23 Jul 2023 05:21:37 +0000 (07:21 +0200)]
[clang][Interp][NFC] Clean up getOrCreateDummy()
Timm Bäder [Sun, 23 Jul 2023 05:20:19 +0000 (07:20 +0200)]
[clang][Interp][NFC] Use existing local variable
Instead of calling getSubExpr() again.
Kishan Parmar [Sun, 23 Jul 2023 07:54:35 +0000 (13:24 +0530)]
[PowerPC/SPE] powerpcspe load and store instruction has
8-bit offset instead of 16-bit unlike other load/store instructions.
so if stack grows any further than 8-bit, create one emergency slot
for spilling.
Fangrui Song [Sun, 23 Jul 2023 01:30:02 +0000 (18:30 -0700)]
[unittest] Fix HighlighterTest.cpp after D151683
:: is now parsed as tok::coloncolon even in C mode.
Brad Smith [Sun, 23 Jul 2023 00:01:27 +0000 (20:01 -0400)]
[PowerPC] Reorder setMaxAtomicSizeInBitsSupported(). NFC
Reorder setMaxAtomicSizeInBitsSupported() in numerical and more logical order.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D155379
Fangrui Song [Sat, 22 Jul 2023 23:50:47 +0000 (16:50 -0700)]
[Support] Change StringMap hash function from xxHash64 to xxh3_64bits
Similar to D142862.
xxh3 is significantly faster than xxh64. Switch to xxh3, as we did for
for lld and llvm-dwarfutil to increase performance (D154813 D155675).
While I think StringMap is not a bottleneck for most applications, it
seems good to eliminate the slower xxh64.
In addition, according to Erik Desjardins, an artificial benchmark of
Rust with very large constant strings improves by ~3% locally.
I have fixed all found issues (~20) separately, but one is remaining:
* ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s has a
failure due to StringMap iteration order. It now passes
with LLVM_ENABLE_REVERSE_ITERATION=on while failing with
LLVM_ENABLE_REVERSE_ITERATION=off.
Reviewed By: erikdesjardins
Differential Revision: https://reviews.llvm.org/D155781
Fangrui Song [Sat, 22 Jul 2023 23:45:32 +0000 (16:45 -0700)]
[gdb-remote] Sort entries in QEnvironment*
Similar to
ae316ac66ffff430997e342772fc4629c1acece0 for
QEMU_(UN)SET_ENV.
The iteration order of StringMap is not guaranteed to be deterministic.
Sort the entries to give deterministic packets for the tests added by
D108018.
Fangrui Song [Sat, 22 Jul 2023 23:06:29 +0000 (16:06 -0700)]
[test] Fix compiler_version.f90 for -DLLVM_APPEND_VC_REV=OFF builds after D152572
Checking the patch version is too strict. Just check major and minor
versions as in clang/test/Driver/immediate-options.c.
Fangrui Song [Sat, 22 Jul 2023 22:57:41 +0000 (15:57 -0700)]
[Frontend] Sort featuresVec for AMDGPU target features
D145579 leverages the iteration order of StringSet, which is not
guaranteed to be deterministic.
Amaury Séchet [Wed, 5 Jul 2023 17:45:01 +0000 (17:45 +0000)]
[DAG] Improve carry reconstruction in combineCarryDiamond.
The gain is usually suffiscient to go the extra mile and reconstruct a carry in some cases.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D154533
Fangrui Song [Sat, 22 Jul 2023 22:47:44 +0000 (15:47 -0700)]
[InstrProf] Stabilize --show-prof-sym-list dump order
D118181 leverages the iteration order of StringSet, which is not
guaranteed to be deterministic.
Fangrui Song [Sat, 22 Jul 2023 22:29:37 +0000 (15:29 -0700)]
[CodeGen] Stabilize C2/D2 to C1/D1 replacement order
The conversion iterates over CodeGenModule::Replacements (a StringMap)
and replaces C2/D2 and moves C1/D1 (
commit
0196a1d98f8a206259a4b5ce93c21807243af92f in 2013, to make the
output look nicer). The iteration order is not guaranteed to be
deterministic, and may cause destructors.cpp to exhibit different
function orders. Use a MapVector instead.
While here, fix an IWYU issue by adding an explicit include, though
MapVector is already used in CodeGenModule.h.
Jessica Clarke [Sat, 22 Jul 2023 22:01:21 +0000 (23:01 +0100)]
[builtins][Mips] Un-break FreeBSD build of __clear_cache
Commit
674a17e9bbe8 ("MIPS/compiler_rt: use synci to flush icache on
r6") completely removed the OS-specific guards under the guise of "For
pre-r6, we can use cacheflush libc function, which is same on Linux and
FreeBSD." However, the code in question had guards for Linux and
OpenBSD, not Linux and FreeBSD, and FreeBSD does not have a cacheflush
libc function as claimed, so this was neither the statement they
intended to make nor was it sufficient justification for making the code
completely unconditional. Whilst the upcoming FreeBSD 14 release has
dropped support for MIPS, FreeBSD 13 has support for it.
Fix this by only calling cacheflush on the OSes where it was previously
called, and not on other OSes where it either definitely isn't available
(FreeBSD) or is unknown (any other OS than the three mentioned in this
commit).
Nuno Lopes [Sat, 22 Jul 2023 21:41:24 +0000 (22:41 +0100)]
[ObjCARC] Use poison instead of undef as placeholder [NFC]
It's used to specify UB (as ptr argument to store) and to RAUW values when UB occurs.
Nuno Lopes [Sat, 22 Jul 2023 21:38:10 +0000 (22:38 +0100)]
[UnifyLoopExits] Use poison instead of undef as placeholder [NFC]
This pass creates phi nodes where only one of the incoming values is used.
The remaining ones can be poison.
Nuno Lopes [Sat, 22 Jul 2023 21:25:41 +0000 (22:25 +0100)]
[RewriteStatepointsForGC] Use poison instead of undef as placeholder [NFC]
This is used in shufflevectors where the placeholder arg is unused.
It's also used when deleting invariant_start
Evgeny Shulgin [Sat, 22 Jul 2023 19:46:31 +0000 (19:46 +0000)]
[clang-tidy] Support concepts in `bugprone-forwarding-reference-overload`
Ignore constrained perfect forwarding constructors.
Fixes: #58230
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D135476
Piotr Zegar [Sat, 22 Jul 2023 19:28:25 +0000 (19:28 +0000)]
[clang-tidy] Fix checks filter with warnings-as-errors
Since commit
5d12b13b0b26bc58b02ee23c369da8b83240cceb, warnings are
internally classified as errors which skip the check filters.
One use-case is particularly affected: you cannot selectively disable
clang-analyzer-core checks, they are force-enabled because required by others.
So enabling warning as errors will show new (and unwanted) errors !
Co-authored-by: kiwixz <kiwixz@outlook.com>
Fixes: #61969
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D146520
Piotr Zegar [Sat, 22 Jul 2023 19:24:53 +0000 (19:24 +0000)]
[clang-tidy] Ignore implcit casts in cppcoreguidelines-owning-memory
Add getCheckTraversalKind to the check in order
to ignore some implicit casts when matching
expresions.
Fixes: #63994
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D156031
Piotr Zegar [Sat, 22 Jul 2023 19:22:21 +0000 (19:22 +0000)]
[clang-tidy][NFC] Fix links in cppcoreguidelines module
Change links in cppcoreguidelines module from github
repository to isocpp.github.io. Unify format.
Craig Topper [Sat, 22 Jul 2023 19:11:13 +0000 (12:11 -0700)]
[RISCV] Simplify setOperationAction for f64 ceil/floor/round/trunc/etc. NFC
We were setting the operations as Legal for Zfa in two places. Use
an else to avoid this.
Shubham Sandeep Rastogi [Sat, 22 Jul 2023 18:20:29 +0000 (11:20 -0700)]
Fix test failure on linaro-clang-armv8-quick with
c5a45b2515e6d2c3d29e86ad41c9be5a88f172d4
Craig Topper [Sat, 22 Jul 2023 18:12:02 +0000 (11:12 -0700)]
[X86] Fix typo in comment. NFC
Craig Topper [Sat, 22 Jul 2023 18:04:25 +0000 (11:04 -0700)]
[LegalizeTypes] Use report_fatal_error instead of llvm_unreachable in the default case of some type legalization handlers.
These can be triggered by in various ways when intrinsics are used wrong or a target doesn't correctly
not support something. Using a fatal error prevents strange behavior
like infinite loops.
We already do this for some of the vector type legalization handles.
Craig Topper [Sat, 22 Jul 2023 17:46:23 +0000 (10:46 -0700)]
[RISCV] Remove unnecessary opcode argument to FPUnaryOp_imm template. NFC
Instead of always passing OPC_OP_FP just hardcode it inside.
Shubham Sandeep Rastogi [Thu, 20 Jul 2023 18:27:16 +0000 (11:27 -0700)]
Change DW_LLE_baseaddr to DW_LLE_baseaddrx in .debug_loclist section
With https://reviews.llvm.org/D154638, the ability to emit a .debug_addr
section has been added to dsymutil. With this, instead of emitting a
DW_LLE_baseaddr in the .debug_loclist section, a DW_LLE_baseaddrx can be
emitted instead, which will allow for more indirection.
Differetial Revision: https://reviews.llvm.org/D155724
Shubham Sandeep Rastogi [Wed, 19 Jul 2023 01:36:30 +0000 (18:36 -0700)]
Do not emit a .debug_addr section if the DW_AT_addr_base is not set.
If the DW_AT_addr_base is not set, dsymutil should not copy any addrx
attributes into the cloned DIE, which will result in no .debug_addr
section being emitted.
Differential Revision: https://reviews.llvm.org/D155666
Shubham Sandeep Rastogi [Wed, 28 Jun 2023 22:19:35 +0000 (15:19 -0700)]
Emit a .debug_addr section with dsymutil
DWARF5 has support for DW_FORM_addrx, which can be useful for space
savings, but it needs a .debug_addr section to be used. dsymutil does
not have the ability to emit a debug_addr section currently. This patch
adds support for that.
Differential Revision: https://reviews.llvm.org/D154638
Simon Pilgrim [Sat, 22 Jul 2023 16:54:48 +0000 (17:54 +0100)]
[X86] LowerRotate - manually expand rotate by splat constant patterns.
Fixes issue identified on #63980 where the undef rotate amounts (during widening from v2i32 -> v4i32) were being constant folded to 0 when the shift amounts are created during expansion, losing the splat'd shift amounts.
Fangrui Song [Sat, 22 Jul 2023 16:52:14 +0000 (09:52 -0700)]
[ORC] Stabilize output stream order
It currently depends on the StringMap iteration order, which is not
guaranteed to be deterministic. Use MapVector to stabilize the order.
Fangrui Song [Sat, 22 Jul 2023 16:37:22 +0000 (09:37 -0700)]
[WebAssembly] Stabilize custom section order
It currently depends on the StringMap iteration order, which is not
guaranteed to be deterministic. Use MapVector to stabilize the order.
Nikolas Klauser [Sat, 22 Jul 2023 16:33:55 +0000 (09:33 -0700)]
[clang] Enable C++11-style attributes in all language modes
This also ignores and deprecates the `-fdouble-square-bracket-attributes` command line flag, which seems to not be used anywhere. At least a code search exclusively found mentions of it in documentation: https://sourcegraph.com/search?q=context:global+-fdouble-square-bracket-attributes+-file:clang/*+-file:test/Sema/*+-file:test/Parser/*+-file:test/AST/*+-file:test/Preprocessor/*+-file:test/Misc/*+archived:yes&patternType=standard&sm=0&groupBy=repo
RFC: https://discourse.llvm.org/t/rfc-enable-c-11-c2x-attributes-in-all-standard-modes-as-an-extension-and-remove-fdouble-square-bracket-attributes
This enables `[[]]` attributes in all C and C++ language modes without warning by default. `-Wc++-extensions` does warn. GCC has enabled this extension in all C modes since GCC 10.
Reviewed By: aaron.ballman, MaskRay
Spies: #clang-vendors, beanz, JDevlieghere, Michael137, MaskRay, sstefan1, jplehr, cfe-commits, lldb-commits, dmgreen, jdoerfert, wenlei, wlei
Differential Revision: https://reviews.llvm.org/D151683
Piotr Zegar [Sat, 22 Jul 2023 15:48:18 +0000 (15:48 +0000)]
[clang-tidy][NFC] Fix list.rst generation when adding check
add_new_check.py does not work properly for checks that
generate fixes in base class. Adding some comments to those
checks in order to fix list.rst generation.
khei4 [Sat, 22 Jul 2023 14:54:33 +0000 (23:54 +0900)]
[MemCpyOpt] add noalias metadata on lifetime intrinsic test case for stack-move optimization(NFC)
Simon Pilgrim [Sat, 22 Jul 2023 15:03:50 +0000 (16:03 +0100)]
[X86] Enable ISD::TRUNCATE support from v2i64 and v4i64 nodes
Addresses the last comment from D154592 - ensure we only truncate with PACKSS/PACKUS when it can be cheaply done (and use shuffles otherwise).
Mark de Wever [Sat, 22 Jul 2023 14:50:58 +0000 (16:50 +0200)]
[NFC][clang] Fixes whitespace.
These changes cause the Buildkite CI to fail.
Mark de Wever [Sat, 22 Jul 2023 14:44:59 +0000 (16:44 +0200)]
[libc++][doc] Uses the proper paper number.
This was brought to my attention in
https://github.com/llvm/llvm-project/commit/
88622aabf10764cc32d546f448076d25b13e94cd#r122279717
LLVM GN Syncbot [Sat, 22 Jul 2023 14:23:37 +0000 (14:23 +0000)]
[gn build] Port
57bd882343f8
Nico Weber [Sat, 22 Jul 2023 14:22:32 +0000 (10:22 -0400)]
[gn] port
822c31a0fe827a6 (HAVE_BUILTIN_THREAD_POINTER)
Should maybe be 1 on linux, at least if is_clang. But just disabling
it everywhere is good enough for now.
Nico Weber [Sat, 22 Jul 2023 14:14:09 +0000 (10:14 -0400)]
[gn] port
b0bb68fd3cb7bfba (LLVM_ENABLE_REVERSE_ITERATION in clang/test)
Nico Weber [Sat, 22 Jul 2023 14:12:01 +0000 (10:12 -0400)]
[gn] port
9996e71f2d (LLVM_ENABLE_REVERSE_ITERATION in llvm/test)
Daniil Dudkin [Sat, 22 Jul 2023 13:25:26 +0000 (16:25 +0300)]
[mlir][LLVM] Introduce reduction intrinsics for minimum/maximum
This patch adds supports for the reduction intrinsic
for floating point minimum and maximum that have
been added to LLVM by https://reviews.llvm.org/D152370.
Related to: #63969
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D155869
Nuno Lopes [Sat, 22 Jul 2023 12:23:32 +0000 (13:23 +0100)]
[Inline] Use poison instead of undef as placeholder [NFC]
Nuno Lopes [Sat, 22 Jul 2023 12:19:42 +0000 (13:19 +0100)]
[StructurizeCFG] Use poison instead of undef as placeholder [NFC]
These are used to create branch instructions. The condition is patched later
Phoebe Wang [Sat, 22 Jul 2023 12:25:44 +0000 (20:25 +0800)]
[X86][BF16] Customize INSERT_VECTOR_ELT for bf16 when feature BF16 is on
Fixes root cause of #63017.
The reason is similar to BUILD_VECTOR. We have legal vector type but
still soft promote for scalar type. So we need to customize these scalar
to vector nodes.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D155961
Matt Arsenault [Fri, 21 Jul 2023 16:33:35 +0000 (12:33 -0400)]
Partially revert "clang/HIP: Remove __llvm_amdgcn_* wrapper hacks"
Revert part of
f407a7399575a6821940973c54754d42e72dd9ce.
Some of the HIP headers were using the f16 rcp inline, such that it
breaks compiling code against non-top-of-tree headers. Need to wait
for a few HIP releases to expire to fully remove these.
Fixes #63981
Matt Arsenault [Sat, 22 Jul 2023 11:45:18 +0000 (07:45 -0400)]
AMDGPU: Silence a gcc warning
Matt Arsenault [Sat, 22 Jul 2023 11:35:04 +0000 (07:35 -0400)]
ConstantFolding: Fix canonicalize folding for dynamic mode denormal inputs
We have to assume the input could be positive-zero. Makes alive2
happy.
Nuno Lopes [Sat, 22 Jul 2023 11:56:03 +0000 (12:56 +0100)]
[CoroSplit] Use poison instead of undef as placeholder [NFC]
Used to construct full structs/vectors
also, covert freeze undef -> freeze poison (same semantics)
Nuno Lopes [Sat, 22 Jul 2023 11:44:03 +0000 (12:44 +0100)]
[SimplifyCFG] Use poison instead of undef as placeholder [NFC]
This is used in a phi node that is created for which only 1 value is accessed (the non-poison)
Fabian Mora [Sat, 22 Jul 2023 11:32:42 +0000 (11:32 +0000)]
[mlir][rocdl] Change the translation of `GridDim*Op` to `__ockl_get_num_groups`
Currently, `ROCDL::GridDim*Op` is being translated to `__ockl_get_global_size`, however
to match the meaning of `gpu.grid_dim` it should instead be translated to
`__ockl_get_num_groups`. This change would also make it agree with the meaning
of `gridDimx.*` in HIP, see:
https://github.com/ROCm-Developer-Tools/hipamd/blob/develop/include/hip/amd_detail/amd_hip_runtime.h#L257
Difference between the functions:
```
__ockl_get_global_size = blockDim * numBlocks
__ockl_get_num_groups = numBlocks
```
Reviewed By: krzysz00
Differential Revision: https://reviews.llvm.org/D156009
Benjamin Kramer [Sat, 22 Jul 2023 11:21:51 +0000 (13:21 +0200)]
Phoebe Wang [Sat, 22 Jul 2023 10:13:58 +0000 (18:13 +0800)]
[X86][BF16] Do not scalarize masked load for BF16 when we have AVX512BF16
Fixes #63017
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D155952
Mark de Wever [Wed, 12 Jul 2023 06:20:26 +0000 (08:20 +0200)]
[libc++][print] Adds stdout functions.
Implements parts of
- P2093R14 Formatted output
- P2539R4 Should the output of std::print to a terminal be
synchronized with the underlying stream?
Depends on D150044
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D155262
Fangrui Song [Sat, 22 Jul 2023 07:00:57 +0000 (00:00 -0700)]
[VirtualFileSystem] Use std::map::emplace
Matthias Springer [Sat, 22 Jul 2023 06:30:40 +0000 (08:30 +0200)]
[mlir][Transforms] GreedyPatternRewriteDriver: Fix `changed` parameter
`changed` was not updated correctly when it was already set to "true" before calling `applyPatternsAndFoldGreedily`.
Differential Revision: https://reviews.llvm.org/D155934
Matthias Springer [Sat, 22 Jul 2023 06:23:48 +0000 (08:23 +0200)]
[mlir][transform] Add `transform.apply_dce` op
Add a transform that eliminates dead operations. This is useful after certain transforms (such as fusion) that create/clone new IR but leave the original IR in place.
Differential Revision: https://reviews.llvm.org/D155954
Fangrui Song [Sat, 22 Jul 2023 06:23:32 +0000 (23:23 -0700)]
[VirtualFileSystem] Make gcc<7.5 happy after
75d71800aa384ee58663d892c325572f5588df2a
There is a libstdc++ stl_map.h bug that is only back ported to 7.5.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78595#c13
```
/tmp/opt/gcc-7.3.0/include/c++/7.3.0/bits/stl_tree.h:2091:28: error: no matching function for call to ‘std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<llvm::vfs::detail::InMemoryNode> >, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<llvm::vfs::detail::InMemoryNode> > >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<llvm::vfs::detail::InMemoryNode> > > >::_M_get_insert_unique_pos(std::pair<llvm::StringRef, std::unique_ptr<llvm::vfs::detail::InMemoryNode> >::first_type&)’
= _M_get_insert_unique_pos(_KeyOfValue()(__v));
~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
```
Just construct a std::string from StringRef to work around it.
Mehdi Amini [Sat, 22 Jul 2023 04:47:33 +0000 (21:47 -0700)]
Fix crash in ODS backend for Type/Attr when an incorrect construct is used for Type/Attr
Instead of crashing, try to print a useful error message.
Valentin Clement [Sat, 22 Jul 2023 04:46:20 +0000 (21:46 -0700)]
[flang][openacc] Fix hasDynamicShape logic
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D155897
khei4 [Sat, 22 Jul 2023 04:08:12 +0000 (13:08 +0900)]
Revert "Reapply: [MemCpyOpt] implement single BB stack-move optimization which unify the static unescaped allocas"
revert because crash on chrome windows https://reviews.llvm.org/D153453#4524256
This reverts commit
569769b64858fd38f41267db41b461d3163aa754.
Nathan Ridge [Fri, 21 Jul 2023 08:05:14 +0000 (04:05 -0400)]
[clang] Add serialization support for the DynamicAllocLValue variant of APValue::LValueBase::Ptr
Differential Revision: https://reviews.llvm.org/D154471
Fangrui Song [Sat, 22 Jul 2023 03:05:35 +0000 (20:05 -0700)]
[CodeGen] Support bitcode input containing multiple modules
When using -fsplit-lto-unit (explicitly specified or due to using
-fsanitize=cfi/-fwhole-program-vtables), the emitted LLVM IR contains a module
flag metadata `"EnableSplitLTOUnit"`. If a module contains both type metadata
and `"EnableSplitLTOUnit"`, `ThinLTOBitcodeWriter.cpp` will write two modules
into the bitcode file. Compiling the bitcode (not ThinLTO backend compilation)
will lead to an error due to `parseIR` requiring a single module.
```
% clang -flto=thin a.cc -c -o a.bc
% clang -c a.bc
% clang -fsplit-lto-unit -flto=thin a.cc -c -o a.bc
% clang -c a.bc
error: Expected a single module
1 error generated.
```
There are multiple ways to have just one module in a bitcode file
output: `-Xclang -fno-lto-unit`, not using features like `-fsanitize=cfi`,
using `-fsanitize=cfi` with `-fno-split-lto-unit`. I think whether a
bitcode input file contains 2 modules (internal implementation strategy)
should not be a criterion to require an additional driver option when
the user seek for a non-LTO compile action.
Let's place the extra module (if present) into CodeGenOptions::LinkBitcodeFiles
(originally for -cc1 -mlink-bitcode-file). Linker::linkModules will link the two
modules together. This patch makes the following commands work:
```
clang -S -emit-llvm a.bc
clang -S a.bc
clang -c a.bc
```
Reviewed By: ormris
Differential Revision: https://reviews.llvm.org/D154923
Richard Smith [Sat, 22 Jul 2023 00:37:55 +0000 (17:37 -0700)]
Optimize emission of `dynamic_cast` to final classes.
- When the destination is a final class type that does not derive from
the source type, the cast always fails and is now emitted as a null
pointer or call to __cxa_bad_cast.
- When the destination is a final class type that does derive from the
source type, emit a direct comparison against the corresponding base
class vptr value(s). There may be more than one such value in the case
of multiple inheritance; check them all.
For now, this is supported only for the Itanium ABI. I expect the same thing is
possible for the MS ABI too, but I don't know what guarantees are made about
vfptr uniqueness.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D154658
Med Ismail Bennani [Fri, 21 Jul 2023 23:43:24 +0000 (16:43 -0700)]
[lldb] Convert script native types to StructuredData counterpart
This patch adds the ability to pass native types from the script
interpreter to methods that use a {SB,}StructuredData argument.
To do so, this patch changes the `ScriptedObject` struture that holds
the pointer to the script object as well as the originating script
interpreter language. It also exposes that to the SB API via a new class
called `SBScriptObject`.
This structure allows the debugger to parse the script object and
convert it to a StructuredData object. If the type is not compatible
with the StructuredData types, we will store its pointer in a
`StructuredData::Generic` object.
This patch also adds some SWIG typemaps that checks the input argument to
ensure it's either an SBStructuredData object, in which case it just
passes it throught, or a python object that is NOT another SB type, to
provide some guardrails for the user.
rdar://
111467140
Differential Revision: https://reviews.llvm.org/D155161
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Sunil Srivastava [Sat, 22 Jul 2023 01:18:21 +0000 (18:18 -0700)]
Set default C++ level for PlayStation(r) to C++17.
Sam McCall [Wed, 19 Jul 2023 02:49:54 +0000 (04:49 +0200)]
[include-cleaner] allow spelling strategies to customize verbatim/system headers
Our use case is wanting to apply a spelling strategy to rewrite the spellings
written in IWYU pragma private directives.
Differential Revision: https://reviews.llvm.org/D155671
Felipe de Azevedo Piovezan [Fri, 21 Jul 2023 23:39:31 +0000 (16:39 -0700)]
[lldb] Consider OP_addrx in DWARFExpression::Update_DW_OP_addr
This rewrites DW_OP_addrx inside DWARFExpression as an DW_OP_addr so
that we can update addresses that are originally located in the
debug_addr section.
The full discussion behind this can be found in
https://discourse.llvm.org/t/dwarfexpression-and-dw-op-addrx/71627/12, but a
summary follows.
When SymbolFileDWARF::ParseVariableDIE creates DWARFExpressions for
variables whose location is an OP_addr, it knows how to remap
addresses appropriately in the DebugMap case. It then calls
DWARFExpression::Update_DW_OP_addr, which updates the value associated
with OP_addr.
However, when we have an OP_addrx, the update function does
nothing. This makes sense, as the DWARFExpression does not have a
mutable view of the debug_addr section. In non-DebugMap flows this is
not an issue, as the debug_addr contains the correct addresses of
variables. In DebugMap flows, this is problematic because the work
done by RelinkOSOAddress is lost. By updating the OP to OP_addr, we
can also update the address as required,
We also explored the alternative of relinking the debug_addr section
when we are initializing OSOs (InitOSO). However, this creates an
inconsistent story for users of
DWARFExpression::GetLocation_DW_OP_addr. This function returns an
address without telling callers whether that address came from an
OP_addr or an OP_addrx. If we preemptively relink OP_addrx results
without doing the same for OP_addr results, then callers can’t know
whether the address they got was an executable address or an object
file address. In other words, they can’t know whether they need to
call LinkOSOFileAddress on those results or not.
This patch addresses the majority of test failures when enabling DWARF
5 for MachO (over 200 test failures).
Differential Revision: https://reviews.llvm.org/D155198