[PATCH] D79355: Mark values as trivially dead when their only use is a start or end lifetime intrinsic.

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 18:50:41 PDT 2020


jdoerfert added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:415
+               return false;
+             });
 
----------------
Style: Capital letter for variables.

Initially, I would prefer to add lifetime markers to the set of droppable uses and ask if the operand has only droppable uses. On second thought, we might not want to do this here because it would aggressively remove assumes. This patch could have a similar effect for useful lifetime markers, e.g. if you cast a pointer twice, once for lifetime once for use. Now I thought first that is unlikely but one of the tests already shows exactly this behavior: https://godbolt.org/z/oRLsrp Removing these lifetime markers and the bitcast is arguably not what we want. Put the call to bar in a loop and it becomes clear.

Multiple ways forward here, two come to mind first: (1) restrict the operand to be an alloca (argument, global, ...) or, (2) strip some casts and geps in both directions and then apply (1).

WDYT?


================
Comment at: llvm/test/Transforms/DeadStoreElimination/lifetime.ll:15
   call void @llvm.lifetime.end.p0i8(i64 1, i8* %A)
-; CHECK: lifetime.end
 
----------------
CHECK-NOT instead?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79355





More information about the llvm-commits mailing list