summaryrefslogtreecommitdiff
path: root/llvm/test/Bitcode/Inputs
AgeCommit message (Collapse)Author
2025-10-15[llvm][DebugInfo] Add 'sourceLanguageVersion' field support to DICompileUnit ↵Michael Buch
(#162632) Depends on: * https://github.com/llvm/llvm-project/pull/162445 In preparation to emit DWARFv6's `DW_AT_language_version`.
2025-02-13[IR][ModRef] Introduce `errno` memory locationAntonio Frighetto
Model C/C++ `errno` macro by adding a corresponding `errno` memory location kind to the IR. Preliminary work to separate `errno` writes from other memory accesses, to the benefit of alias analyses and optimization correctness. Previous discussion: https://discourse.llvm.org/t/rfc-modelling-errno-memory-effects/82972.
2024-11-28[Bitcode] Verify types for aggregate initializersNikita Popov
Unfortunately all the nice error messages get lost because we don't forward errors from lazy value materialization. Fixes https://github.com/llvm/llvm-project/issues/117707.
2023-10-05[BitcodeReader] Replace unsupported constexprs in metadata with undefNikita Popov
Metadata (via ValueAsMetadata) can reference constant expressions that may no longer be supported. These references can both be in function-local metadata and module metadata, if the same expression is used in multiple functions. At least in theory, such references could also be in metadata proper, rather than just inside ValueAsMetadata references in calls. Instead of trying to expand these expressions (which we can't reliably do), pretend that the constant has been deleted, which means that ValueAsMetadata references will get replaced with undef metadata. Fixes https://github.com/llvm/llvm-project/issues/68281.
2023-09-28[Bitcode] Support expanding constant expressions in function metadataNikita Popov
This fixes the bitcode upgrade failure reported in https://reviews.llvm.org/D155924#4616789. The expansion always happens in the entry block, so this may be inaccurate if there are trapping constant expressions.
2023-04-20[ThinLTO] Remove BlockCount for non partial sample profile buildsTeresa Johnson
As pointed out in https://discourse.llvm.org/t/undeterministic-thin-index-file/69985, the block count added to distributed ThinLTO index files breaks incremental builds on ThinLTO - if any linked file has a different number of BBs, then the accumulated sum placed in the index files will change, causing all ThinLTO backend compiles to be redone. The block count is only used for scaling of partial sample profiles, and was added in D80403 for D79831. This patch simply removes this field from the index files of non partial sample profile compiles, which is NFC on the output of the compiler. We subsequently need to see if this can be removed for partial sample profiles without signficant performance loss, or redesigned in a way that does not destroy caching. Differential Revision: https://reviews.llvm.org/D148746
2022-12-19[Intrinsic] Rename flt.rounds intrinsic to get.roundingQiu Chaofan
Address the inconsistency between FLT_ROUNDS_ and SET_ROUNDING SDAG node. Rename FLT_ROUNDS_ to GET_ROUNDING and add llvm.get.rounding intrinsic to replace flt.rounds. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D139507
2022-12-14[Bitcode] Remove auto-detection for typed pointersNikita Popov
Always read bitcode according to the -opaque-pointers mode. Do not perform auto-detection to implicitly switch to typed pointers. This is a step towards removing typed pointer support, and also eliminates the class of problems where linking may fail if a typed pointer module is loaded before an opaque pointer module. (The latest place where this was encountered is D139924, but this has previously been fixed in other places doing bitcode linking as well.) Differential Revision: https://reviews.llvm.org/D139940
2022-07-04[Bitcode] Use bitcode input for test (NFC)Nikita Popov
The constant expression used in the test will become invalid in the future. Convert the input into bitcode, so we test that auto- upgrade happens gracefully once this is the case.
2022-03-11[Bitcode] Don't confuse type attributes on declaration and callNikita Popov
We should not be using APIs here that try to fetch the attribute from both the call attributes and the function attributes. Otherwise we'll try to upgrade a non-existent sret attribute on the call using the attribute on the function.
2022-03-11[Bitcode] Check for type mismatch when assigning valueNikita Popov
If the value is forward-declared, then the type must match, otherwise we can't RAUW.
2022-03-11[Bitcode] Report error for missing element type for attr upgradeNikita Popov
Otherwise this is going to crash either the TypeFinder or the Verifier.
2022-02-09[Bitcode] Fix size check for DIImportedEntity recordNikita Popov
This was using && instead of ||.
2022-02-09[Bitcode] Check minimum size of constant GEP recordNikita Popov
Checking this early, because we may end up reading up to two records before the operands.
2022-02-08[Bitstream] Make MaxChunkSize word-size independentNikita Popov
We only support chunks <= 32 bits regardless of whether we're running on a 64-bit platform or not. Chunk size > 32 <= 64 would cause UB in the reading code.
2022-02-08[Bitcode] Prevent OOB read for invalid name sizeNikita Popov
2022-02-08[Bitstream] Check for unterminated VBRNikita Popov
This avoid shift larger than bitwidth UB.
2022-02-07[Bitcode] Replace assertion with checkNikita Popov
2022-02-07[Bitcode] Add missing test fileNikita Popov
This was supposed to be part of ec18030f5fc1f4a08326e65fe06c6f265a829f4c.
2022-02-07[Bitcode] Guard against out of bounds value referenceNikita Popov
We should make sure that the value ID is in bounds, otherwise we will assert / read out of bounds.
2022-02-07[Bitcode] Don't assert on invalid attribute group recordNikita Popov
Report an error instead.
2022-02-07[Bitstream] Reject implausibly large reservationsNikita Popov
If we're trying to reserve more memory than bits in the stream, reject this early to avoid OOM.
2022-02-07[Bitcode] Handle invalid abbrev number error more gracefullyNikita Popov
Avoid report_fatal_error(), propagate the error upwards instead.
2021-10-06Reland [IR] Increase max alignment to 4GBArthur Eubanks
Currently the max alignment representable is 1GB, see D108661. Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bits are clear which can be used for some optimizations, e.g. https://crbug.com/1016945. This uses an extra bit in instructions that carry an alignment. We can store 15 bits of "free" information, and with this change some instructions (e.g. AtomicCmpXchgInst) use 14 bits. We can increase the max alignment representable above 4GB (up to 2^62) since we're only using 33 of the 64 values, but I've just limited it to 4GB for now. The one place we have to update the bitcode format is for the alloca instruction. It stores its alignment into 5 bits of a 32 bit bitfield. I've added another field which is 8 bits and should be future proof for a while. For backward compatibility, we check if the old field has a value and use that, otherwise use the new field. Updating clang's max allowed alignment will come in a future patch. Reviewed By: hans Differential Revision: https://reviews.llvm.org/D110451
2021-10-06Revert "Reland [IR] Increase max alignment to 4GB"Arthur Eubanks
This reverts commit 8d64314ffea55f2ad94c1b489586daa8ce30f451.
2021-10-06Reland [IR] Increase max alignment to 4GBArthur Eubanks
Currently the max alignment representable is 1GB, see D108661. Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bits are clear which can be used for some optimizations, e.g. https://crbug.com/1016945. This uses an extra bit in instructions that carry an alignment. We can store 15 bits of "free" information, and with this change some instructions (e.g. AtomicCmpXchgInst) use 14 bits. We can increase the max alignment representable above 4GB (up to 2^62) since we're only using 33 of the 64 values, but I've just limited it to 4GB for now. The one place we have to update the bitcode format is for the alloca instruction. It stores its alignment into 5 bits of a 32 bit bitfield. I've added another field which is 8 bits and should be future proof for a while. For backward compatibility, we check if the old field has a value and use that, otherwise use the new field. Updating clang's max allowed alignment will come in a future patch. Reviewed By: hans Differential Revision: https://reviews.llvm.org/D110451
2021-10-06Revert "[IR] Increase max alignment to 4GB"Arthur Eubanks
This reverts commit df84c1fe78130a86445d57563dea742e1b85156a. Breaks some bots
2021-10-06[IR] Increase max alignment to 4GBArthur Eubanks
Currently the max alignment representable is 1GB, see D108661. Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bits are clear which can be used for some optimizations, e.g. https://crbug.com/1016945. This uses an extra bit in instructions that carry an alignment. We can store 15 bits of "free" information, and with this change some instructions (e.g. AtomicCmpXchgInst) use 14 bits. We can increase the max alignment representable above 4GB (up to 2^62) since we're only using 33 of the 64 values, but I've just limited it to 4GB for now. The one place we have to update the bitcode format is for the alloca instruction. It stores its alignment into 5 bits of a 32 bit bitfield. I've added another field which is 8 bits and should be future proof for a while. For backward compatibility, we check if the old field has a value and use that, otherwise use the new field. Updating clang's max allowed alignment will come in a future patch. Reviewed By: hans Differential Revision: https://reviews.llvm.org/D110451
2021-05-21[Verifier] Move some atomicrmw/cmpxchg checks to instruction creationArthur Eubanks
These checks already exist as asserts when creating the corresponding instruction. Anybody creating these instructions already need to take care to not break these checks. Move the checks for success/failure ordering in cmpxchg from the verifier to the LLParser and BitcodeReader plus an assert. Add some tests for cmpxchg ordering. The .bc files are created from the .ll files with an llvm-as with these checks disabled. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102803
2021-03-29Reapply "OpaquePtr: Turn inalloca into a type attribute"Matt Arsenault
This reverts commit 07e46367baeca96d84b03fa215b41775f69d5989.
2021-03-29Revert "Reapply "OpaquePtr: Turn inalloca into a type attribute""Oliver Stannard
Reverting because test 'Bindings/Go/go.test' is failing on most buildbots. This reverts commit fc9df309917e57de704f3ce4372138a8d4a23d7a.
2021-03-28Reapply "OpaquePtr: Turn inalloca into a type attribute"Matt Arsenault
This reverts commit 20d5c42e0ef5d252b434bcb610b04f1cb79fe771.
2021-03-28Revert "OpaquePtr: Turn inalloca into a type attribute"Nico Weber
This reverts commit 4fefed65637ec46c8c2edad6b07b5569ac61e9e5. Broke check-clang everywhere.
2021-03-28OpaquePtr: Turn inalloca into a type attributeMatt Arsenault
I think byval/sret and the others are close to being able to rip out the code to support the missing type case. A lot of this code is shared with inalloca, so catch this up to the others so that can happen.
2020-12-14OpaquePtr: Require byval on x86_intrcc parameter 0Matt Arsenault
Currently the backend special cases x86_intrcc and treats the first parameter as byval. Make the IR require byval for this parameter to remove this special case, and avoid the dependence on the pointee element type. Fixes bug 46672. I'm not sure the IR is enforcing all the calling convention constraints. clang seems to ignore the attribute for empty parameter lists, but the IR tolerates it.
2020-08-04[StackSafety,NFC] Add combined index testVitaly Buka
Missing file for the previous patch
2020-07-23[Bitcode] Avoid duplicating linker option when upgradingSteven Wu
Summary: The upgrading path from old ModuleFlag based linker options to the new NamedMetadata based linker option in in materializeMetadata() which gets called once for the module and once for every GV. The linker options are getting dup'ed every time and it can create massive amount of the linker options in the object file that gets created from old bitcode. Fix the problem by checking if the new option exists or not before upgrade again. rdar://64543389 Reviewers: pcc, t.p.northover, dexonsmith, arphaman Reviewed By: arphaman Subscribers: hiraditya, jkorous, ributzka, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D83688
2020-07-23[Bitcode] Drop invalid branch_weight in BitcodeReaderSteven Wu
Summary: If bitcode reader gets an invalid branch weight, drop that from the inputs. This allows us to read the broken modules we generated before the verifier was able to catch this. rdar://64870641 Reviewers: yrouban, t.p.northover, dexonsmith, arphaman, aprantl Reviewed By: aprantl Subscribers: aprantl, hiraditya, jkorous, ributzka, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D83699
2019-07-14Recommit "[BitcodeReader] Validate OpNum, before accessing Record array."Florian Hahn
This recommits r365750 (git commit 8b222ecf2769ee133691f208f6166ce118c4a164) Original message: Currently invalid bitcode files can cause a crash, when OpNum exceeds the number of elements in Record, like in the attached bitcode file. The test case was generated by clusterfuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15698 Reviewers: t.p.northover, thegameg, jfb Reviewed By: jfb Differential Revision: https://reviews.llvm.org/D64507 llvm-svn: 365750jkkkk llvm-svn: 366018
2019-07-11Revert [BitcodeReader] Validate OpNum, before accessing Record array.Florian Hahn
This reverts r365750 (git commit 8b222ecf2769ee133691f208f6166ce118c4a164) llvm-dis runs out of memory while opening invalid-fcmp-opnum.bc on llvm-hexagon-elf, probably because the bitcode file contains other suspicious values. http://lab.llvm.org:8011/builders/llvm-hexagon-elf/builds/21949 llvm-svn: 365757
2019-07-11[BitcodeReader] Validate OpNum, before accessing Record array.Florian Hahn
Currently invalid bitcode files can cause a crash, when OpNum exceeds the number of elements in Record, like in the attached bitcode file. The test case was generated by clusterfuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15698 Reviewers: t.p.northover, thegameg, jfb Reviewed By: jfb Differential Revision: https://reviews.llvm.org/D64507 llvm-svn: 365750
2019-05-30Reapply: IR: add optional type to 'byval' function parametersTim Northover
When we switch to opaque pointer types we will need some way to describe how many bytes a 'byval' parameter should occupy on the stack. This adds a (for now) optional extra type parameter. If present, the type must match the pointee type of the argument. The original commit did not remap byval types when linking modules, which broke LTO. This version fixes that. Note to front-end maintainers: if this causes test failures, it's probably because the "byval" attribute is printed after attributes without any parameter after this change. llvm-svn: 362128
2019-05-29Revert "IR: add optional type to 'byval' function parameters"Tim Northover
The IRLinker doesn't delve into the new byval attribute when mapping types, and this breaks LTO. llvm-svn: 362029
2019-05-29IR: add optional type to 'byval' function parametersTim Northover
When we switch to opaque pointer types we will need some way to describe how many bytes a 'byval' parameter should occupy on the stack. This adds a (for now) optional extra type parameter. If present, the type must match the pointee type of the argument. Note to front-end maintainers: if this causes test failures, it's probably because the "byval" attribute is printed after attributes without any parameter after this change. llvm-svn: 362012
2019-04-17[ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbolsSteven Wu
Summary: Reapply r357931 with fixes to ThinLTO testcases and llvm-lto tool. ThinLTOCodeGenerator currently does not preserve llvm.used symbols and it can internalize them. In order to pass the necessary information to the legacy ThinLTOCodeGenerator, the input to the code generator is rewritten to be based on lto::InputFile. Now ThinLTO using the legacy LTO API will requires data layout in Module. "internalize" thinlto action in llvm-lto is updated to run both "promote" and "internalize" with the same configuration as ThinLTOCodeGenerator. The old "promote" + "internalize" option does not produce the same output as ThinLTOCodeGenerator. This fixes: PR41236 rdar://problem/49293439 Reviewers: tejohnson, pcc, kromanova, dexonsmith Reviewed By: tejohnson Subscribers: ormris, bd1976llvm, mehdi_amini, inglorion, eraman, hiraditya, jkorous, dexonsmith, arphaman, dang, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60421 llvm-svn: 358601
2018-09-20[Bitcode] Address backwards compat bug in r342631Vedant Kumar
r342631 expanded bitc::METADATA_LOCATION by one element. The bitcode metadata loader was changed in a backwards-incompatible way, leading to crashes when disassembling old bitcode: assertion: empty() && "PlaceholderQueue hasn't been flushed before being destroyed" Assertion failed: (empty() && "PlaceholderQueue hasn't been flushed before being destroyed") This commit teaches the metadata loader to assume that the newly-added IsImplicitCode bit is 'false' when not present in old bitcode. I've added a bitcode compat regression test. rdar://44645820 llvm-svn: 342678
2018-07-09[BitcodeReader] Infer the correct runtime preemption for GlobalValueSteven Wu
Summary: To allow bitcode built by old compiler to pass the current verifer, BitcodeReader needs to auto infer the correct runtime preemption from linkage and visibility for GlobalValues. Since llvm-6.0 bitcode already contains the new field but can be incorrect in some cases, the attribute needs to be recomputed all the time in BitcodeReader. This will make all the GVs has dso_local marked correctly if read from bitcode, and it should still allow the verifier to catch mistakes in optimization passes. This should fix PR38009. Reviewers: sfertile, vsk Reviewed By: vsk Subscribers: dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D49039 llvm-svn: 336560
2017-08-03Do not want to use BFI to get profile count for sample pgoDehao Chen
Summary: For SamplePGO, we already record the callsite count in the call instruction itself. So we do not want to use BFI to get profile count as it is less accurate. Reviewers: tejohnson, davidxl, eraman Reviewed By: eraman Subscribers: sanjoy, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D36025 llvm-svn: 309964
2017-07-06Bitcode: Include any strings added to the string table in the module hash.Peter Collingbourne
Differential Revision: https://reviews.llvm.org/D35037 llvm-svn: 307286
2016-11-29Bitcode: Introduce BitcodeWriter interface.Peter Collingbourne
This interface allows clients to write multiple modules to a single bitcode file. Also introduce the llvm-cat utility which can be used to create a bitcode file containing multiple modules. Differential Revision: https://reviews.llvm.org/D26179 llvm-svn: 288195