- May 24, 2024
-
-
Simon Pilgrim authored
SHL/SRL are guaranteed to fold to zero, SRA is guaranteed to fold to 'all sign bits'
-
Christian Ulmann authored
This commit removes the LLVM dialect's type consistency pass. This pass was originally introduced to make type information on memory operations consistent. The main benefactor of this consistency where Mem2Reg and SROA, which were in the meantime improved to no longer require consistent type information. Apart from providing a no longer required functionality, the pass had some fundamental flaws that lead to issues: * It introduced trivial GEPs (only zero indices) that could be folded again. * Aggressively splitting stores lead to substantial performance regressions in some cases. Subsequent memory coalescing were not able to recover this information, due to using non-trivial bit-fiddling.
-
Kiran Chandramohan authored
…280)" This reverts commit 6977bfb5.
-
Paul Walker authored
Move the undef'ing of library specific macros to the places in the code base where they are defined.
-
Adrian Kuegel authored
-
Ramkumar Ramachandra authored
The test symbolic-stride.ll does not exercise all codepaths in getStrideFromPointer, particularly when the operand is an SCEVIntegralCastExpr. Cover these codepaths as well. This patch serves as pre-commit tests for #92119.
-
Ramkumar Ramachandra authored
-
Florian Hahn authored
Use DTU to queue DominatorTree updates directly when connecting basic blocks during VPlan execution. This simplifies DT updates and will also automatically allow updating the DT for the VPlan-native path as additional benefit in a follow-up. PR: https://github.com/llvm/llvm-project/pull/92525
-
Jeff Niu authored
Okay, so an apparently not-so-rare crash could occur if the `perInstanceState` point got re-allocated to the same pointer as before. All the values have been destroyed, so the TLC is left with dangling pointers, but then the same `ValueT *` is pulled out of the TLC and dereferenced, leading to a crash. I suppose the purpose of the `weak_ptr` was that it would get reset to a default state when the `perInstanceState` shared pointer got destryoed (its reference count would only ever be 1, very briefly 2 when it gets aliased to a `ValueT *` but then assigned to a `weak_ptr`). Basically, there are circular references between TLC instances and `perInstanceState` instances and we have to ensure there are no dangling references. 1. Ensure the TLC entries are reset to a valid default state if the TLC (i.e. owning thread) lives longer than the `perInstanceState`. a. This is currently achieved by storing `weak_ptr` in the TLC. 2. If `perInstanceState` lives longer than the TLC, it cannot contain dangling references to entries in destroyed TLCs. a. This is not currently the case. 3. If both are being destroyed at the same time, we cannot race. a. The destructors are synchronized because the TLC destructor locks `weak_ptr` while it is destructing, preventing the owning `perInstanceState` of the entry from destructing. If `perInstanceState` got destructed first, the `weak_ptr` lock would fail. And 4. Ensure `get` in the common (initialized) case is as fast as possible (no atomics). We need to change the TLC to store a `ValueT **` so that it can be shared with entries owned by `perInstanceState` and written to null when they are destroyed. However, this is no longer something synchronized by an atomic, meaning that (2) becomes a problem. This is fine because when TLC destructs, we remove the entries from `perInstanceState` that could reference the TLC entries. This patch shows the same perf gain as before but hopefully without the bug.
-
Adam Siemieniuk authored
Extend existing tensor patterns to simplify pad-like tensor pack/unpack into expand/collapse shape operations.
-
Oleksandr "Alex" Zinenko authored
The ODS-generated code has the following: ``` ::mlir::TypedValue<::mlir::transform::OperationType> getAlloca() { return ::llvm::cast<::mlir::TypedValue<::mlir::transform::OperationType>>( *getODSOperands(0).begin()); } ``` that may require the compiler seing the definition of `OperationType` so include the corresponding header. -
Adam Siemieniuk authored
Tweaks linalg.generic verification in block pack matmul pass to avoid using emitting errors which pollute stderr during operation matching.
-
klensy authored
Moved fixes for mlir from https://github.com/llvm/llvm-project/pull/91854 , plus few additional in second commit. --------- Co-authored-by:
klensy <nightouser@gmail.com>
-
Pavel Labath authored
This is a regression from #91591. Turns out std::mutex does not prevent code from running twice.
🤦 -
LLVM GN Syncbot authored
-
Ryosuke Niwa authored
[alpha.webkit.UncountedLocalVarsChecker] Detect assignments to uncounted local variable and parameters. (#92639) This PR updates alpha.webkit.UncountedLocalVarsChecker to emit warnings for assignments to uncounted local variable and parameters instead of just the initialization during the declaration.
-
Oleksandr "Alex" Zinenko authored
When this code was written, we didn't have proper isinstance support for operation classes in Python. Now we do, so there is no reason to keep the expensive exception-based flow.
-
Adam Siemieniuk authored
-
Pavel Labath authored
The don't currently work (and they're also not particularly useful, since all of the remote stuff happens inside lldb). This saves us from annotating tests one by one.
-
Vitaly Buka authored
Fails on https://lab.llvm.org/buildbot/#/builders/85/builds/24181 and https://lab.llvm.org/buildbot/#/builders/5/builds/43589 Reverts llvm/llvm-project#89245
-
Freddy Ye authored
-
Nikita Popov authored
This reverts commit 8cc8e5d6. This reverts commit dae55c89. Causes major compile-time regressions for unoptimized builds.
-
Vincent Lee authored
When running `check-lld-elf` on my CentOS 9 linux box, the test seems to expect `000021` instead of `00001{{[def]}}` -
Phoebe Wang authored
-
LLVM GN Syncbot authored
-
Kiran Chandramohan authored
Enables a few sections, simd, taskloop, use_device tests.
-
huangqinjin authored
After https://github.com/llvm/llvm-project/pull/68921, clang-cl gained option `-x` but only for CUDA/HIP. This commit simply removes the restriction on parameters to `-x`. Especially, it is able to use `-x c++-module` and `-x c++-system-header` to build C++20 modules and header units with clang-cl. This effectively reverts commit fe082124. Closes https://github.com/llvm/llvm-project/issues/88006.
-
Matt Arsenault authored
-
Michael Liao authored
- This change is after running ObjCContractPass in default codegen pipeline (#92331).
-
Jeff Niu authored
The ThreadLocalCache implementation is used by the MLIRContext (among other things) to try to manage thread contention in the StorageUniquers. There is a bunch of fancy shared pointer/weak pointer setups that basically keeps everything alive across threads at the right time, but a huge bottleneck is the `weak_ptr::lock` call inside the `::get` method. This is because the `lock` method has to hit the atomic refcount several times, and this is bottlenecking performance across many threads. However, all this is doing is checking whether the storage is initialized. We know that it cannot be an expired weak pointer because the thread local cache object we're calling into owns the memory and is still alive for the method call to be valid. Thus, we can store and extra `Value *` inside the thread local cache for speedy retrieval if the cache is already initialized for the thread, which is the common case. This also tightens the size of the critical section in the same method by scoping the mutex more to just the mutation on `perInstanceState`. Before: <img width="560" alt="image" src="https://github.com/llvm/llvm-project/assets/15016832/f4ea3f32-6649-4c10-88c4-b7522031e8c9"> After: <img width="344" alt="image" src="https://github.com/llvm/llvm-project/assets/15016832/1216db25-3dc1-4b0f-be89-caeff622dd35">
-
Chen Zheng authored
Support the address selection for toc-data globals in fast isel. This benefits instruction selection for fast-isel for toc data symbol for example for load selection. This also aligns the code generation with/without -mtocdata.
-
Wentao Zhang authored
The problematic program is as follows: ```shell #define pre_a 0 #define PRE(x) pre_##x void f(void) { PRE(a) && 0; } int main(void) { return 0; } ``` in which after token concatenation (`##`), there's another nested macro `pre_a`. Currently only the outer expansion region will be produced. ([compiler explorer link](https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:___c,selection:(endColumn:29,endLineNumber:8,positionColumn:29,positionLineNumber:8,selectionStartColumn:29,selectionStartLineNumber:8,startColumn:29,startLineNumber:8),source:'%23define+pre_a+0%0A%23define+PRE(x)+pre_%23%23x%0A%0Avoid+f(void)+%7B%0A++++PRE(a)+%26%26+0%3B%0A%7D%0A%0Aint+main(void)+%7B+return+0%3B+%7D'),l:'5',n:'0',o:'C+source+%231',t:'0')),k:51.69491525423727,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((g:!((h:compiler,i:(compiler:cclang_assertions_trunk,filters:(b:'0',binary:'1',binaryObject:'1',commentOnly:'0',debugCalls:'1',demangle:'0',directives:'0',execute:'0',intel:'0',libraryCode:'1',trim:'1',verboseDemangling:'0'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:2,lang:___c,libs:!(),options:'-fprofile-instr-generate+-fcoverage-mapping+-fcoverage-mcdc+-Xclang+-dump-coverage-mapping+',overrides:!(),selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:1),l:'5',n:'0',o:'+x86-64+clang+(assertions+trunk)+(Editor+%231)',t:'0')),k:34.5741843594503,l:'4',m:28.903654485049834,n:'0',o:'',s:0,t:'0'),(g:!((h:output,i:(compilerName:'x86-64+clang+(trunk)',editorid:1,fontScale:14,fontUsePx:'0',j:2,wrap:'1'),l:'5',n:'0',o:'Output+of+x86-64+clang+(assertions+trunk)+(Compiler+%232)',t:'0')),header:(),l:'4',m:71.09634551495017,n:'0',o:'',s:0,t:'0')),k:48.30508474576271,l:'3',n:'0',o:'',t:'0')),l:'2',m:100,n:'0',o:'',t:'0')),version:4)) ```text f: File 0, 4:14 -> 6:2 = #0 Decision,File 0, 5:5 -> 5:16 = M:0, C:2 Expansion,File 0, 5:5 -> 5:8 = #0 (Expanded file = 1) File 0, 5:15 -> 5:16 = #1 Branch,File 0, 5:15 -> 5:16 = 0, 0 [2,0,0] File 1, 2:16 -> 2:23 = #0 File 2, 1:15 -> 1:16 = #0 File 2, 1:15 -> 1:16 = #0 Branch,File 2, 1:15 -> 1:16 = 0, 0 [1,2,0] ``` The inner expansion region isn't produced because: 1. In the range-based for loop quoted below, each sloc is processed and possibly emit a corresponding expansion region. 2. For our sloc in question, its direct parent returned by `getIncludeOrExpansionLoc()` is a `<scratch space>`, because that's how `##` is processed. https://github.com/llvm/llvm-project/blob/88b6186af3908c55b357858eb348b5143f21c289/clang/lib/CodeGen/CoverageMappingGen.cpp#L518-L520 3. This `<scratch space>` cannot be found in the FileID mapping so `ParentFileID` will be assigned an `std::nullopt` https://github.com/llvm/llvm-project/blob/88b6186af3908c55b357858eb348b5143f21c289/clang/lib/CodeGen/CoverageMappingGen.cpp#L521-L526 4. As a result this iteration of for loop finishes early and no expansion region is added for the sloc. This problem gets worse with MC/DC: as the example shows, there's a branch from File 2 but File 2 itself is missing. This will trigger assertion failures. The fix is more or less a workaround and takes a similar approach as #89573. ~~Depends on #89573.~~ This includes #89573. Kudos to @chapuni! This and #89573 together fix #87000: I tested locally, both the reduced program and my original use case (fwiw, Linux kernel) can run successfully. --------- Co-authored-by:NAKAMURA Takumi <geek4civic@gmail.com>
-
Brendan Dahl authored
Adds a builtin and intrinsic for the f16x8.splat instruction. Specified at: https://github.com/WebAssembly/half-precision/blob/29a9b9462c9285d4ccc1a5dc39214ddfd1892658/proposals/half-precision/Overview.md Note: the current spec has f16x8.splat as opcode 0x123, but this is incorrect and will be changed to 0x120 soon.
-
Amir Ayupov authored
Deleted basic blocks are required for correct mapping of branches modified by SCTC. Increases BAT size, bytes: - large binary: 8622496 -> 8703244. - small binary (X86/bolt-address-translation.test): 928 -> 940. Test Plan: updated bb-with-two-tail-calls.s Reviewers: ayermolo, dcci, maksfb, rafaelauler Reviewed By: rafaelauler Pull Request: https://github.com/llvm/llvm-project/pull/91906
-
Dan Liew authored
[BoundsSafety] Reland #93121 Allow 'counted_by' attribute on pointers in structs in C (#93121) Fixes #92687. Previously the attribute was only allowed on flexible array members. This patch patch changes this to also allow the attribute on pointer fields in structs and also allows late parsing of the attribute in some contexts. For example this previously wasn't allowed: ``` struct BufferTypeDeclAttributePosition { size_t count; char* buffer __counted_by(count); // Now allowed } ``` Note the attribute is prevented on pointee types where the size isn't known at compile time. In particular pointee types that are: * Incomplete (e.g. `void`) and sizeless types * Function types (e.g. the pointee of a function pointer) * Struct types with a flexible array member This patch also introduces late parsing of the attribute when used in the declaration attribute position. For example ``` struct BufferTypeDeclAttributePosition { char* buffer __counted_by(count); // Now allowed size_t count; } ``` is now allowed but **only** when passing `-fexperimental-late-parse-attributes`. The motivation for using late parsing here is to avoid breaking the data layout of structs in existing code that want to use the `counted_by` attribute. This patch is the first use of `LateAttrParseExperimentalExt` in `Attr.td` that was introduced in a previous patch. Note by allowing the attribute on struct member pointers this now allows the possiblity of writing the attribute in the type attribute position. For example: ``` struct BufferTypeAttributePosition { size_t count; char *__counted_by(count) buffer; // Now allowed } ``` However, the attribute in this position is still currently parsed immediately rather than late parsed. So this will not parse currently: ``` struct BufferTypeAttributePosition { char *__counted_by(count) buffer; // Fails to parse size_t count; } ``` The intention is to lift this restriction in future patches. It has not been done in this patch to keep this size of this commit small. There are also several other follow up changes that will need to be addressed in future patches: * Make late parsing working with anonymous structs (see `on_pointer_anon_buf` in `attr-counted-by-late-parsed-struct-ptrs.c`). * Allow `counted_by` on more subjects (e.g. parameters, returns types) when `-fbounds-safety` is enabled. * Make use of the attribute on pointer types in code gen (e.g. for `_builtin_dynamic_object_size` and UBSan's array-bounds checks). This work is heavily based on a patch originally written by Yeoul Na. ** Differences between #93121 and this patch ** * The memory leak that caused #93121 to be reverted (see #92687) should now be fixed. See "The Memory Leak". * The fix to `pragma-attribute-supported-attributes-list.test` (originally in cef6387e) has been incorporated into this patch. * A relaxation of counted_by semantics (originally in 112eadd5) has been incorporated into this patch. * The assert in `Parser::DistributeCLateParsedAttrs` has been removed because that broke downstream code. * The switch statement in `Parser::ParseLexedCAttribute` has been removed in favor of using `Parser::ParseGNUAttributeArgs` which does the same thing but is more feature complete. * The `EnterScope` parameter has been plumbed through `Parser::ParseLexedCAttribute` and `Parser::ParseLexedCAttributeList`. It currently doesn't do anything but it will be needed in future commits. ** The Memory Leak ** The problem was that these lines parsed the attributes but then did nothing to free the memory ``` assert(!getLangOpts().CPlusPlus); for (auto *LateAttr : LateFieldAttrs) ParseLexedCAttribute(*LateAttr); ``` To fix this this a new `Parser::ParseLexedCAttributeList` method has been added (based on `Parser::ParseLexedAttributeList`) which does the necessary memory management. The intention is to merge these two methods together so there is just one implementation in a future patch (#93263). A more principled fixed here would be to fix the ownership of the `LateParsedAttribute` objects. In principle `LateParsedAttrList` should own its pointers exclusively and be responsible for deallocating them. Unfortunately this is complicated by `LateParsedAttribute` objects also being stored in another data structure (`LateParsedDeclarations`) as can be seen below (`LA` gets stored in two places). ``` // Handle attributes with arguments that require late parsing. LateParsedAttribute *LA = new LateParsedAttribute(this, *AttrName, AttrNameLoc); LateAttrs->push_back(LA); // Attributes in a class are parsed at the end of the class, along // with other late-parsed declarations. if (!ClassStack.empty() && !LateAttrs->parseSoon()) getCurrentClass().LateParsedDeclarations.push_back(LA); ``` this means the ownership of LateParsedAttribute objects isn't very clear. rdar://125400257 -
-
Haohai Wen authored
On Windows, perfscript generated by sep contains CR+LF at the end of LBR records line. This '\r' will be treated as a LBR record when running llvm-profgen on Linux and then generate warning.
-
Matheus Izvekov authored
Reverts llvm/llvm-project#92855 This is causing issues, there are still being reduced, but does look like a problem. See PR for user reports.
-
Fangrui Song authored
Similar to previous cleanup.
-