[all-commits] [llvm/llvm-project] 053924: Reland [IR] Increase max alignment to 4GB
aeubanks via All-commits
all-commits at lists.llvm.org
Wed Oct 6 13:32:31 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 05392466f02bca49bf3381a64d109c5263354169
https://github.com/llvm/llvm-project/commit/05392466f02bca49bf3381a64d109c5263354169
Author: Arthur Eubanks <aeubanks at google.com>
Date: 2021-10-06 (Wed, 06 Oct 2021)
Changed paths:
M clang/lib/CodeGen/CGBlocks.cpp
M clang/lib/CodeGen/CGCall.cpp
M clang/lib/CodeGen/CGDecl.cpp
M clang/lib/CodeGen/CodeGenModule.cpp
M clang/test/CodeGen/builtin-assume-aligned.c
M clang/test/CodeGen/catch-alignment-assumption-attribute-align_value-on-paramvar.cpp
M clang/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-three-params-variable.cpp
M clang/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-three-params.cpp
M clang/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-two-params.cpp
M llvm/include/llvm/Bitcode/BitcodeCommon.h
M llvm/include/llvm/IR/Argument.h
M llvm/include/llvm/IR/DataLayout.h
M llvm/include/llvm/IR/Function.h
M llvm/include/llvm/IR/GlobalObject.h
M llvm/include/llvm/IR/Instruction.h
M llvm/include/llvm/IR/Instructions.h
M llvm/include/llvm/IR/Value.h
M llvm/include/llvm/Transforms/IPO/Attributor.h
M llvm/include/llvm/Transforms/Utils/ASanStackFrameLayout.h
M llvm/lib/AsmParser/LLParser.cpp
M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
M llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
M llvm/lib/CodeGen/MIRParser/MIParser.cpp
M llvm/lib/CodeGen/SafeStack.cpp
M llvm/lib/CodeGen/SafeStackLayout.cpp
M llvm/lib/CodeGen/SafeStackLayout.h
M llvm/lib/IR/DataLayout.cpp
M llvm/lib/IR/Function.cpp
M llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
M llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
M llvm/test/Assembler/align-inst-alloca.ll
M llvm/test/Assembler/align-inst-load.ll
M llvm/test/Assembler/align-inst-store.ll
M llvm/test/Assembler/align-inst.ll
M llvm/test/Bitcode/Inputs/invalid-align.bc
M llvm/test/Bitcode/inalloca.ll
R llvm/test/CodeGen/MIR/X86/load-with-1gb-alignment.mir
A llvm/test/CodeGen/MIR/X86/load-with-max-alignment.mir
M llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead.ll
M llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead_2.ll
M llvm/test/Transforms/Attributor/IPConstantProp/PR26044.ll
M llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll
M llvm/test/Transforms/Attributor/callbacks.ll
M llvm/test/Transforms/Attributor/liveness.ll
M llvm/test/Transforms/Attributor/memory_locations.ll
M llvm/test/Transforms/Attributor/noalias.ll
M llvm/test/Transforms/Attributor/nocapture-1.ll
M llvm/test/Transforms/Attributor/noundef.ll
M llvm/test/Transforms/Attributor/undefined_behavior.ll
M llvm/test/Transforms/Attributor/value-simplify.ll
M llvm/test/Transforms/GVN/PRE/2017-06-28-pre-load-dbgloc.ll
M llvm/test/Transforms/InstCombine/atomic.ll
M llvm/test/Transforms/InstCombine/getelementptr.ll
M llvm/test/Transforms/InstCombine/load.ll
M llvm/test/Transforms/InstCombine/mempcpy.ll
M llvm/test/Transforms/InstCombine/pr44245.ll
M llvm/test/Transforms/InstCombine/store.ll
M llvm/test/Transforms/OpenMP/parallel_level_fold.ll
M llvm/test/Verifier/align-md.ll
M llvm/unittests/IR/ValueTest.cpp
Log Message:
-----------
Reland [IR] Increase max alignment to 4GB
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
More information about the All-commits
mailing list