[all-commits] [llvm/llvm-project] 170c4d: [ArgPromotion] Unify byval promotion with non-byval
Pavel Samolysov via All-commits
all-commits at lists.llvm.org
Tue Jun 28 05:23:18 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 170c4d21bd94d4f183c2fec1dd7d261360df7bae
https://github.com/llvm/llvm-project/commit/170c4d21bd94d4f183c2fec1dd7d261360df7bae
Author: Pavel Samolysov <samolisov at gmail.com>
Date: 2022-06-28 (Tue, 28 Jun 2022)
Changed paths:
M llvm/include/llvm/Transforms/IPO/ArgumentPromotion.h
M llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
M llvm/test/Transforms/ArgumentPromotion/attrs.ll
M llvm/test/Transforms/ArgumentPromotion/byval-2.ll
R llvm/test/Transforms/ArgumentPromotion/byval-through-pointer-promotion.ll
A llvm/test/Transforms/ArgumentPromotion/byval-with-padding.ll
M llvm/test/Transforms/ArgumentPromotion/byval.ll
M llvm/test/Transforms/ArgumentPromotion/dbg.ll
M llvm/test/Transforms/ArgumentPromotion/fp80.ll
M llvm/test/Transforms/ArgumentPromotion/metadata.ll
A llvm/test/Transforms/ArgumentPromotion/store-after-load.ll
A llvm/test/Transforms/ArgumentPromotion/store-into-inself.ll
Log Message:
-----------
[ArgPromotion] Unify byval promotion with non-byval
It makes sense to handle byval promotion in the same way as non-byval
but also allowing `store` instructions. However, these should
use the same checks as the `load` instructions do, i.e. be part of the
`ArgsToPromote` collection. For these instructions, the check for
interfering modifications can be disabled, though. The promotion
algorithm itself has been modified a lot: all the accesses (i.e. loads
and stores) are rewritten to the emitted `alloca` instructions. To
optimize these new `alloca`s out, the `PromoteMemToReg` function from
`Transforms/Utils/PromoteMemoryToRegister.cpp` file is invoked after
promotion.
In order to let the `PromoteMemToReg` promote as many `alloca`s as it
is possible, there should be no `GEP`s from the `alloca`s. To
eliminate the `GEP`s, its own `alloca` is generated for every argument
part because a single `alloca` for the whole argument (that
significantly simplifies the code of the pass though) unfortunately
cannot be used.
The idea comes from the following discussion:
https://reviews.llvm.org/D124514#3479676
Differential Revision: https://reviews.llvm.org/D125485
More information about the All-commits
mailing list