- May 27, 2024
-
-
Sirraide authored
Currently, if the argument to `__builtin_assume` and friends contains side-effects, we issue the following diagnostic: ``` <source>:1:34: warning: the argument to '__builtin_assume' has side effects that will be discarded [-Wassume] 1 | void f(int x) { __builtin_assume(x++); } | ``` The issue here is that this diagnostic misrepresents what is actually happening: not only do we discard the side-effects of the expression, but we also don’t even emit any assumption information at all because the backend is not equipped to deal with eliminating side-effects in cases such as this. This has caused some confusion (see #91612) beacuse the current wording of the warning suggests that, sensibly, only the side-effects of the expression, and not the assumption itself, will be discarded. This pr updates the diagnostic to state what is actually happening: that the assumption has no effect at all because its argument contains side-effects: ``` <source>:1:34: warning: assumption is ignored because it contains (potential) side-effects [-Wassume] 1 | void f(int x) { __builtin_assume(x++); } | ``` I’ve deliberately included ‘(potential)’ here because even expressions that only contain potential side-effects (e.g. `true ? x : x++` or a call to a function that is pure, but we don’t know that it is) cause the assumption to be discarded. This, too, has caused some confusion because it was erroneously assumed that Clang would e.g. infer that a function call is pure and not discard the assumption as a result when that isn’t the case. This is intended to be temporary; we should revert back to the original diagnostic once we have proper support for assumptions with side-effects in the backend (in which case the side-effects will still be discarded, but the assumption won’t) This fixes #91612. -
Rouzbeh authored
[LoopCacheAnalysis] Fix loop cache cost to always round the cost up to the nearest integer number (#88915) Currently loop cache analysis uses following formula to evaluate cost of an RefGroup for a consecutive memory access: `RefCost=(TripCount*Stride)/CLS` This cost evaluates to zero when `TripCount*Stride` is smaller than cache-line-size. This results in wrong cost value for a loop and misleads loopInterchange decisions as shown in [this case](https://llvm.godbolt.org/z/jTz1vn4hn). This patch fixes the problem by rounding the cost to 1 once this problem happens.
-
Hendrik Hübner authored
[Clang] Issue an error when an atomic builtin is called with a pointer to a zero-size object (#91057) When an atomic builtin is called with a pointer to an object of size zero, an arithmetic exception gets thrown because there is a modulo operation with the objects size in codegen. Diagnose this in sema instead. Fixes #90330.
-
Timm Bäder authored
Previously, we pushed a pointer to the stack and later tried to use it as if it was a function pointer, which doesn't work.
-
Timm Bäder authored
So I don't have to count them down all the time.
-
Shan Huang authored
Fix #85069 .
-
Kareem Ergawy authored
This PR contains 2 commits: 1. A commit to reapply changes introduced #91116 (was reverted earlier due to test suite failures) 2. A commit containing a possible solution for the issue causing the test suite failures. In particular, it introduces a simple symbol visitor class to keep track of the current active OMP construct and marking this active construct as the scope defining the symbol being visisted.
-
Marius Brehler authored
-
Pierre van Houtryve authored
Values are small, and std::set is just unnecessarily expensive. It stood out in some quick performance profiling. DenseSet is a better alternative in this case.
-
Mirko Brkušanin authored
-
Timm Bäder authored
-
kadir çetinkaya authored
Prevent OOB access by not printing target parameter range when there's a pack in the function parameters. Fixes https://github.com/llvm/llvm-project/issues/93076. Fixes https://github.com/llvm/llvm-project/issues/76354. Fixes https://github.com/llvm/llvm-project/issues/70191.
-
Pierre van Houtryve authored
Using MMRAs, allow `builtin_amdgcn_fence` to emit fences that only target one or more address spaces, instead of fencing all address spaces at once. This is done through a `amdgpu-as` MMRA. Currently focused on OpenCL fences, but can very easily support more AS names and codegen on more than just fences.
-
jeanPerier authored
Add pass to lower assumed-rank operations. The current patch adds codegen for fir.rebox_assumed_rank. It will be the pass lowering fir.select_rank. fir.rebox_assumed_rank is lowered to a call to CopyAndUpdateDescriptor runtime API. Note that the lowering ends-up allocating two new descriptors at the LLVM level (one alloca created by the pass for the CopyAndUpdateDescriptor result descriptor argument, the second one is created by the fir.load of the result descriptor in codegen). LLVM is currently unable to properly optimize and merge those allocas. The "nocapture" attribute added to CopyAndUpdateDescriptor arguments gives part of the information to LLVM, but the fir.load codegen of descriptors must be updated to use llvm.memcpy instead of llvm.load+store to allow LLVM to optimize it. This will be done in later patch. -
jeanPerier authored
As described in https://github.com/llvm/llvm-project/blob/main/flang/docs/AssumedRank.md, add an operation to make copies of assumed-rank descriptors where lower bounds, attributes, or dynamic type may have been changed.
-
LLVM GN Syncbot authored
-
Pierre van Houtryve authored
(with fix for ubsan) This enables the --lto-partitions option to work more consistently. This module splitting logic is fully aware of AMDGPU modules and their specificities and takes advantage of them to split modules in a way that avoids compilation issue (such as resource usage being incorrectly represented). This also includes a logging system that's more elaborate than just LLVM_DEBUG which allows printing logs to uniquely named files, and optionally with all value names hidden so they can be safely shared without leaking informatiton about the source. Logs can also be enabled through an environment variable, which avoids the sometimes complicated process of passing a -mllvm option all the way from clang driver to the offload linker that handles full LTO codegen.
-
jeanPerier authored
When passing assumed-rank around, the lower bounds, dynamic type and attribute must sometimes be updated to match the dummy attributes. See https://github.com/llvm/llvm-project/blob/main/flang/docs/AssumedRank.md#annex-1---descriptor-temporary-for-the-dummy-arguments for more details. Doing it inline would require generating many instructions and block CFG at the LLVM IR dialect level in codegen. Go for a simple runtime API instead. A matching fir.rebox_assumed_rank operation will be created and will allow for easier future optimizations when inlining is done in FIR.
-
Younan Zhang authored
[clang][CodeComplete] Recurse into the subexpression of deref operator in getApproximateType (#93404) The issue with the previous implementation bc31be79 was that getApproximateType could potentially return a null QualType for a dereferencing operator, which is not what its caller wants.
-
Balázs Kéri authored
-
Matheus Izvekov authored
-
eaeltsin authored
Fix https://github.com/llvm/llvm-project/issues/93298.
-
Martin Storsjö authored
On Windows, long is always 32 bit, thus one can't use long for casting pointers to integers, on 64 bit architectures. Instead use long long, which should be large enough. This avoids errors like "error: cast from pointer to smaller type 'long' loses information" in this testcase. This condition only seems to be an error in mingw mode; in MSVC mode (clang-cl), this is only a warning.
-
Wang Pengcheng authored
So that the loop won't be hoisted completely.
-
Nikita Popov authored
In #88846 I changed this code to use RAUW to perform the replacement instead of manual updates -- but kept the outer loop, which means we try to perform RAUW once per user. However, some of the users might be freed by the RAUW operation, resulting in use-after-free. The case where this happens is constant users where the replacement might result in the destruction of the original constant. Fixes https://github.com/llvm/llvm-project/issues/92991.
-
Dmitry Vasilyev authored
Do not denormalize the path. This patch fixes #93092. BTW, it would be great to be able to pass the style or triple to SBFileSpec. Currently it is impossible to create a posix SBFileSpec on the Windows host.
-
Nikita Popov authored
This function has been deprecated in favor of the XML_PARSE_NOBLANKS option. The code already uses the option, so remove the call. If this call served some additional purpose, then it wasn't tested. Fixes https://github.com/llvm/llvm-project/issues/86029.
-
Nikita Popov authored
This reverts commit bb02bf78. PR merged without review.
-
Nikita Popov authored
This reverts commit 6d484965. PR merged without review.
-
Nikita Popov authored
This reverts commit 6e14583c. PR merged without review.
-
Nikita Popov authored
This reverts commit 0f8a7473. PR merged without approval.
-
Nikita Popov authored
This reverts commit 558c5196. PR merged without review.
-
Nikita Popov authored
Revert "[InstCombine] Add reverse of ((X << nuw Z) sub nuw Y) >>u exact Z --> X sub nuw (Y >>u exact Z) (#91386)" This reverts commit c42c3208. PR merged without review.
-
Chuanqi Xu authored
Required in the review process of https://github.com/llvm/llvm-project/pull/92083
-
Chuanqi Xu authored
It should be unalignhed_decl_id_t
-
Shengchen Kan authored
No update for non-APX tests. This patch resolves TODO in #91747.
-
Freddy Ye authored
[X86][MC] Support encoding optimization & assembler relaxation about immediate operands for CCMP (#85175)
-
Phoebe Wang authored
Reverts llvm/llvm-project#83631 Using `HasX86_64` is incorrect.
-
Shengchen Kan authored
In #91747, we changed the SDNode from `X86ISD::SUB` (FROM) to `X86ISD::CCMP` (TO) in the DAGCombine. The value type of `X86ISD::SUB` can be `i8, i32` while the value type of `X86ISD::CCMP` is i32. This breaks the assumption that the value type should match after the combine and triggers the error ``` SelectionDAG.cpp:10942: void llvm::SelectionDAG::transferDbgValues(llvm::SDValue, llvm::SDValue, unsigned int, unsigned int, bool): Assertion `FromNode && ToNode && "Can't modify dbg values"' failed. ``` when running tests llvm/test/CodeGen/X86/apx/ccmp.ll llvm/test/CodeGen/X86/apx/ctest.ll in Release build when LLVM_ENABLE_ASSERTIONS is on. In this patch, we fix it by creating a merged value.
-