[all-commits] [llvm/llvm-project] 7739be: [ArgPromotion] Remove dead code produced by removi...

Jeffrey Byrnes via All-commits all-commits at lists.llvm.org
Thu Mar 23 09:48:06 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7739be7c6b6d017bf6b4445c5010e59314655995
  Author: Jeff Byrnes <jeffrey.byrnes at amd.com>
  Date:   2023-03-23 (Thu, 23 Mar 2023)

  Changed paths:
    M llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
    M llvm/test/Transforms/ArgumentPromotion/propagate-remove-dead-args.ll
    M llvm/test/Transforms/ArgumentPromotion/store-into-inself.ll
    M llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion-loads.ll

  Log Message:
  [ArgPromotion] Remove dead code produced by removing dead arguments

ArgPromotion currently produces phantom / dead loads. A good example of this is store-into-inself.ll. First, ArgPromo finds the promotable argument %p in @l. Then it inserts a load of %p in the caller, and passes instead the loaded value / transforms the function body. PromoteMem2Reg is able to optimize out the entire function body, resulting in an unused argument. In a subsequent ArgPromotion pass, it removes the dead argument, resulting in a dead load in the caller. These dead loads may reduce effectiveness of other transformations (e.g. SimplifyCFG, MergedLoadStoreMotion).

This patch removes loads and geps that are made dead in the caller after removal of dead args.

Differential Revision: https://reviews.llvm.org/D146327

More information about the All-commits mailing list