This is an archive of the discontinued LLVM Phabricator instance.

WIP: [Bitcode][C-API][IR] Introduce bitcode load version 2 and freeze_bits metadata
Needs ReviewPublic

Authored by jmciver on Aug 19 2023, 11:45 AM.

Details

Summary

OVERVIEW:

This is the first in a sequence of exploratory patches using poison semantics
for uninitialized memory.

METADATA:

The new metadata, freeze_bits, is used to convert poison to a nondeterministic
value. Application of freeze_bits is limited load type instructions only.

See the following URL for the RFC discussion:
https://discourse.llvm.org/t/rfc-load-instruction-uninitialized-memory-semantics/67481

BITCODE:

To facilitate in place migration of bitcode. A new versions of load and load
atomic are added; numeric identifiers 21 and 53. Auto migration is performed to
older loads by automatically applying freeze_bits metadata.

IR:

For convenience, an isFreezing parameter is add IRBuilder load functions. This
appends the attribute !freeze_bits to a load instruction. All IRBuilder
CreateLoad and CreateAlignedLoad function definitions default isFreezing to
true. This will allow front ends to transition to the new load instruction
semantics in a piecemeal fashion.

C-API:

Load instruction version 1 semantics are supported using the legacy function
LLVMBuildLoad2, which will add attribute !freeze_bits for compatibility. Load
instruction version 2 semantics are supported using function
LLVMBuildLoad3. This commit marks LLVMBuildLoad2 for future deprecation.

Diff Detail

Event Timeline

jmciver created this revision.Aug 19 2023, 11:45 AM
Herald added a project: Restricted Project. · View Herald Transcript
jmciver added a subscriber: nlopes.Aug 19 2023, 8:09 PM
jmciver edited the summary of this revision. (Show Details)Aug 21 2023, 9:59 AM
jmciver published this revision for review.Aug 21 2023, 10:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2023, 10:05 AM