- Jan 18, 2024
-
-
Timm Baeder authored
Add a new emitComplexReal() helper function and use that for the new casts as well as the old __real implementation.
-
Guillaume Chatelet authored
Another patch is needed to cover `DyadicFloat` and `NormalFloat` constructors.
-
Yingwei Zheng authored
InstCombine already handles the pattern `(shl ShVal, (X & (Width - 1))) | (lshr ShVal, ((-X) & (Width - 1)))`. Under certain circumstances, `X & (Width - 1)` will be simplified to `X`. Therefore, this patch adds support for the pattern `(shl ShVal, X) | (lshr ShVal, ((-X) & (Width - 1)))`. Alive2: https://alive2.llvm.org/ce/z/P7JQ2V
-
Congcong Cai authored
Fixes: https://github.com/llvm/llvm-project/issues/78076 Alive2 Proof: https://alive2.llvm.org/ce/z/XEDy0f
-
paperchalice authored
Reverts llvm/llvm-project#70912. This breaks some bazel tests.
-
Simon Pilgrim authored
We had the same helper function in shuffle decode / vector constant code - move this to X86InstrInfo to avoid duplication.
-
Alexey Lapshin authored
This patch is extracted from #74725. Both dwarflinkers contain similar classes for indexed values. Move the code into the DWARFLinkerBase.
-
Jie Fu authored
llvm-project/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp:1539:10: error: unused variable 'SWaitInst' [-Werror,-Wunused-variable] auto SWaitInst = ^ 1 error generated. -
Paul Osmialowski authored
The most recent changes to `omp_lib.h.var` have re-introduced some compatibility issues that had to be fixed due to the similar changes in the past. Namely: 1. D120707 has removed the "use omp_lib_kinds" statement and replaced it with import 2. D114537 added line continuation to the long lines This patch introduces the same kind of changes in order to restore compatibility with some more restrictive Fortran compilers so their users could still benefit from the LLVM's OpenMP Fortran library.
-
Utkarsh Saxena authored
### Problem ```cpp co_task<int> coro() { int a = 1; auto lamb = [a]() -> co_task<int> { co_return a; // 'a' in the lambda object dies after the iniital_suspend in the lambda coroutine. }(); co_return co_await lamb; } ``` [use-after-free](https://godbolt.org/z/GWPEovWWc) Lambda captures (even by value) are prone to use-after-free once the lambda object dies. In the above example, the lambda object appears only as a temporary in the call expression. It dies after the first suspension (`initial_suspend`) in the lambda. On resumption in `co_await lamb`, the lambda accesses `a` which is part of the already-dead lambda object. --- ### Solution This problem can be formulated by saying that the `this` parameter of the lambda call operator is a lifetimebound parameter. The lambda object argument should therefore live atleast as long as the return object. That said, this requirement does not hold if the lambda does not have a capture list. In principle, the coroutine frame still has a reference to a dead lambda object, but it is easy to see that the object would not be used in the lambda-coroutine body due to no capture list. It is safe to use this pattern inside a`co_await` expression due to the lifetime extension of temporaries. Example: ```cpp co_task<int> coro() { int a = 1; int res = co_await [a]() -> co_task<int> { co_return a; }(); co_return res; } ``` --- ### Background This came up in the discussion with seastar folks on [RFC](https://discourse.llvm.org/t/rfc-lifetime-bound-check-for-parameters-of-coroutines/74253/19?u=usx95). This is a fairly common pattern in continuation-style-passing (CSP) async programming involving futures and continuations. Document ["Lambda coroutine fiasco"](https://github.com/scylladb/seastar/blob/master/doc/lambda-coroutine-fiasco.md) by Seastar captures the problem. This pattern makes the migration from CSP-style async programming to coroutines very bugprone. Fixes https://github.com/llvm/llvm-project/issues/76995 --------- Co-authored-by:Chuanqi Xu <yedeng.yd@linux.alibaba.com>
-
Florian Hahn authored
Replacing a free extension with 2 or more extensions unnecessarily increases the number of IR instructions without providing any benefits. It also unnecessarily causes operations to be performed on wider types than necessary. In some cases, the extra extensions also pessimize codegen (see bfis-in-loop.ll). The changes in arm64-codegen-prepare-extload.ll also show that we avoid promotions that should only be performed in stress mode. PR: https://github.com/llvm/llvm-project/pull/77094
-
Jay Foad authored
Update SIMemoryLegalizer and SIInsertWaitcnts to use separate wait instructions per counter (e.g. S_WAIT_LOADCNT) and split VMCNT into separate LOADCNT, SAMPLECNT and BVHCNT counters.
-
Jay Foad authored
-
Jay Foad authored
-
Jay Foad authored
https://github.com/llvm/llvm-project/pull/70634 has disabled use of potentially negative scratch offsets, but we can use it on GFX12. --------- Co-authored-by:
Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
-
pvanhout authored
-
Alexey Lapshin authored
This patch renames values of dsymutil/llvm-dwarfutil options: --linker apple -> --linker classic --linker llvm -> --linker parallel The purpose to rename options is to avoid using vendor names and to match with library names. It should be safe to rename options at current stage as they are not seemed widely used(we may not preserve backward compatibility).
-
Kerry McLaughlin authored
-
Nikita Popov authored
Resolve the two FIXMEs: Perform the binop identitiy fold with AllowRHSConstant, and remove redundant folds later in the code.
-
Guillaume Chatelet authored
-
Matthew Devereau authored
This patch adds conditional enabling/disabling of streaming mode for functions which have both the aarch64_pstate_sm_compatible and aarch64_pstate_sm_body attributes. This combination allows callees to determine if switching streaming mode is required instead of relying on the caller.
-
Luke Lau authored
LLVM vector reduction intrinsics return a scalar result, but on RISC-V vector reduction instructions write the result in the first element of a vector register. So when a reduction in a loop uses a scalar phi, we end up with unnecessary scalar moves: loop: vfmv.s.f v10, fa0 vfredosum.vs v8, v8, v10 vfmv.f.s fa0, v8 This mainly affects ordered fadd reductions, which has a scalar accumulator operand. This tries to vectorize any scalar phis that feed into a fadd reduction in RISCVCodeGenPrepare, converting: loop: %phi = phi <float> [ ..., %entry ], [ %acc, %loop] %acc = call float @llvm.vector.reduce.fadd.nxv4f32(float %phi, <vscale x 2 x float> %vec) ``` to loop: %phi = phi <vscale x 2 x float> [ ..., %entry ], [ %acc.vec, %loop] %phi.scalar = extractelement <vscale x 2 x float> %phi, i64 0 %acc = call float @llvm.vector.reduce.fadd.nxv4f32(float %x, <vscale x 2 x float> %vec) %acc.vec = insertelement <vscale x 2 x float> poison, float %acc.next, i64 0 Which eliminates the scalar -> vector -> scalar crossing during instruction selection. -
Chuanqi Xu authored
Close https://github.com/llvm/llvm-project/issues/76638. See the issue for the context of the change.
-
LLVM GN Syncbot authored
-
Ivan Kosarev authored
-
jeanPerier authored
A user defining and using free/malloc via BIND(C) would previously cause flang to crash when generating LLVM IR with error "redefinition of symbol named 'free'". This was caused by flang codegen not expecting to find a mlir::func::FuncOp definition of these function and emitting a new mlir::LLVM::FuncOp that later conflicted when translating the mlir::func::FuncOp.
-
Mirko Brkušanin authored
-
Paschalis Mpeis authored
LoopVectorizer is aware when a target can replace a scalable frem instruction with a vector library call for a given VF and it returns the relevant cost. Otherwise, it returns an invalid cost (as previously). Add test that check costs on AArch64, when there is no vector library available and when there is (with and without tail-folding). NOTE: Invoking CostModel directly (not through LV) would still return invalid costs.
-
Balázs Kéri authored
Operators that are overloadable may be parsed as `CXXOperatorCallExpr` or as `UnaryOperator` (or `BinaryOperator`). This depends on the context and can be different if a similar construct is imported into an existing AST. The two "forms" of the operator call AST nodes should be detected as equivalent to allow AST import of these cases. This fix has probably other consequences because if a structure is imported that has `CXXOperatorCallExpr` into an AST with an existing similar structure that has `UnaryOperator` (or binary), the additional data in the `CXXOperatorCallExpr` node is lost at the import (because the existing node will be used). I am not sure if this can cause problems.
-
martinboehme authored
The CFG doesn't contain a CFGElement for the `CXXDefaultInitExpr::getInit()`, so it makes sense to consider the `CXXDefaultInitExpr` to be the expression that originally constructs the object.
-
martinboehme authored
-
Mariusz Sikora authored
-
Stanislav Mekhanoshin authored
LDA DMA loads increase VMCNT and a load from the LDS stored must wait on this counter to only read memory after it is written. Wait count insertion pass does not track memory dependencies, it tracks register dependencies. To model the LDS dependency a pseudo register is used in the scoreboard, acting like if LDS DMA writes it and LDS load reads it. This patch adds 8 more pseudo registers to use for independent LDS locations if we can prove they are disjoint using alias analysis. Fixes: SWDEV-433427
-
Mikael Holmen authored
Without this gcc warned ../lib/CodeGen/AsmPrinter/DwarfDebug.cpp:3585:70: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 3584 | ((&Current == &AccelDebugNames) && | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3585 | (Unit.getUnitDie().getTag() != dwarf::DW_TAG_type_unit)) && | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ 3586 | "Kind is CU but TU is being processed."); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/CodeGen/AsmPrinter/DwarfDebug.cpp:3589:70: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 3588 | ((&Current == &AccelTypeUnitsDebugNames) && | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3589 | (Unit.getUnitDie().getTag() == dwarf::DW_TAG_type_unit)) && | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ 3590 | "Kind is TU but CU is being processed."); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -
Matt Arsenault authored
-
Sander de Smalen authored
This decouples the Arm type attributes from other bits, which means the data will only be allocated when a function uses these Arm attributes. The first patch adds the bit `HasArmTypeAttributes` to `FunctionTypeBitfields`, which grows from 62 bits to 63 bits. In the second patch, I've moved this bit (`HasArmTypeAttributes`) to `FunctionTypeExtraBitfields`, because it looks like the bits in `FunctionTypeBitfields` are precious and we really don't want that struct to grow beyond 64 bits. I've split this out into two patches to explain the rationale, but those can be squashed before merging.
-
Matheus Izvekov authored
This fixes a crash where `path::parent_path` causes an invalid access on a string upon receiving a path that consists of a single colon. On Windows machine, with runtime checks enabled build, upon `clang -I: test.cc` produces: ``` Assertion failed: Index < Length && "Invalid index!", file llvm\include\llvm/ADT/StringRef.h, line 232 ... #6 0x00007ff7816201eb `anonymous namespace'::parent_path_end llvm\lib\Support\Path.cpp:144:0 #7 0x00007ff781620135 llvm::sys::path::parent_path(class llvm::StringRef, enum llvm::sys::path::Style) llvm\lib\Support\Path.cpp:470:0 ``` Ideally, we can look for the last colon starting from the last character, but we can instead start from second to last, and handle empty paths by abusing `0 - 1 == npos`.
-
paperchalice authored
Add `-start/stop-before/after` support for CodeGenPassBuilder. Part of #69879.
-
Nathan Ridge authored
[clangd] Handle an expanded token range that ends in the `eof` token in TokenBuffer::spelledForExpanded() (#78092) Such ranges can legitimately arise in the case of invalid code, such as a declaration missing an ending brace. Fixes https://github.com/clangd/clangd/issues/1559
-
Nico Weber authored
-