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

John McIver via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 21 10:05:11 PDT 2023


jmciver created this revision.
Herald added a reviewer: deadalnix.
Herald added subscribers: jdoerfert, hiraditya.
Herald added a project: All.
jmciver edited the summary of this revision.
jmciver added a subscriber: nlopes.
jmciver added reviewers: nikic, efriedma, fhahn.
Herald added a subscriber: StephenFan.
jmciver edited the summary of this revision.
jmciver published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158342

Files:
  llvm/include/llvm-c/Core.h
  llvm/include/llvm/Bitcode/LLVMBitCodes.h
  llvm/include/llvm/IR/Attributes.td
  llvm/include/llvm/IR/AutoUpgrade.h
  llvm/include/llvm/IR/FixedMetadataKinds.def
  llvm/include/llvm/IR/IRBuilder.h
  llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Transforms/Utils/CodeExtractor.cpp
  llvm/test/Bitcode/bcanalyzer-atomics.ll
  llvm/test/Bitcode/compatibility-3.6.ll
  llvm/test/Bitcode/compatibility-3.7.ll
  llvm/test/Bitcode/compatibility-3.8.ll
  llvm/test/Bitcode/compatibility-3.9.ll
  llvm/test/Bitcode/compatibility-4.0.ll
  llvm/test/Bitcode/compatibility-5.0.ll
  llvm/test/Bitcode/compatibility-6.0.ll
  llvm/test/Bitcode/memInstructions.3.2.ll
  llvm/test/Bitcode/upgrade-loadv1-loadv2.ll
  llvm/test/Bitcode/upgrade-loadv1-loadv2.ll.bc
  llvm/tools/llvm-c-test/calc.c
  llvm/tools/llvm-c-test/echo.cpp
  llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158342.551779.patch
Type: text/x-patch
Size: 35115 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230821/106f7dd5/attachment.bin>


More information about the llvm-commits mailing list