[PATCH] D125485: [ArgPromotion] Unify byval promotion with non-byval

Pavel Samolysov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 16 07:24:47 PDT 2022


psamolysov added a comment.

Unfortunately, `PromoteMemToReg` optimizes almost nothing. If there is a `GEP` from an `alloca`, and this `GEP` is used by `store`, for example, the `isAllocaPromotable` function returns `false` because the `if (!onlyUsedByLifetimeMarkersOrDroppableInsts(GEPI))` (which allows intrinsics as `GEP` users only) check fails. I always use `store` instructions to write the new argument values into the `alloca`, so this check will always fail for structures and will pass for primitives only. I've tried to run the `mem2reg` pass using the `opt` utility and get the same result, my IR after the `ArgumentPromotion` pass looks as not optimized. The SROA pass works fine, but I'm not sure is this a good idea to run SROA directly from another pass (the `PromoteMemToReg` function creates an instance of the `PromoteMem2Reg` class and calls its `run` member function but this class is not a pass).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125485/new/

https://reviews.llvm.org/D125485



More information about the llvm-commits mailing list