[PATCH] D119013: [ArgPromotion][AMDGPU] New MSSA-based function argument promotion pass with input/output argument support
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 18 03:41:11 PST 2022
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/IPO/MSSAArgPromotion.cpp:711
+void ArgumentPromoter::promoteInOutArg(ArgPromotionInfo &ArgInfo,
+ RetValuesMap &RetValues) {
+ SmallDenseMap<BasicBlock *, SmallVector<Instruction *, 4>, 16> MemInsts;
----------------
For the actual promotion, have you considered making use of PromoteMemToReg? Basically, replace the old argument with an alloca that is stored on entry and read on exit, and then run mem2reg on that alloca?
```
define i32 @test(i32 %arg) {
%old.arg = alloca i32
store i32, i32* %old.arg
// Code uses old.arg
%ret = load i32, i32* %old.arg
ret i32 %ret
}
```
================
Comment at: llvm/test/Transforms/ArgumentPromotion/inoutargs.ll:1
+; RUN: opt < %s -passes=mssaargpromotion -S | FileCheck %s
+
----------------
Please use update_test_checks.py.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119013/new/
https://reviews.llvm.org/D119013
More information about the llvm-commits
mailing list