llvm-project/llvm/test/Transforms/ArgumentPromotion
Florian Hahn e0905553b4
[ArgPromotion] Delay dead GEP removal until doPromotion.
Currently ArgPromotion removes dead GEPs as part of the legality check
in isSafeToPromoteArgument. If no promotion happens, this means the pass
claims no modifications happened, even though GEPs were removed.

This patch fixes the issue by delaying removal of dead GEPs until
doPromotion: isSafeToPromoteArgument can simply skips dead GEPs and
the code in doPromotion dealing with GEPs is updated to account for
dead GEPs. Once we committed to promotion, it should be safe to
remove dead GEPs.

Alternatively isSafeToPromoteArgument could return an additional boolean
to indicate whether it made changes, but this is quite cumbersome and
there should be no real benefit of weeding out some dead GEPs here if we
do not perform promotion.

I added a test for the case where dead GEPs need to be removed when
promotion happens in 578c5a0c6e.

Fixes PR47477.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D93991
2021-01-04 09:51:20 +00:00
..
X86
2008-02-01-ReturnAttrs.ll
2008-07-02-array-indexing.ll
2008-09-07-CGUpdate.ll
2008-09-08-CGUpdateSelfEdge.ll
aggregate-promote-dead-gep.ll [ArgPromotion] Add test with dead GEP when promoting. 2021-01-03 15:39:06 +00:00
aggregate-promote.ll
attrs.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
basictest.ll
byval-2.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
byval.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
chained.ll
control-flow.ll
control-flow2.ll
crash.ll [FileCheck] Enforce --allow-unused-prefixes=false for llvm/test/Transforms 2020-12-09 08:51:38 -08:00
dbg.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
dead-gep-no-promotion.ll [ArgPromotion] Delay dead GEP removal until doPromotion. 2021-01-04 09:51:20 +00:00
fp80.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
inalloca.ll
invalidation.ll
musttail.ll
naked_functions.ll
nonzero-address-spaces.ll
pr27568.ll
pr32917.ll
pr33641_remove_arg_dbgvalue.ll [test] Simplify pr33641_remove_arg_dbgvalue.ll 2020-10-23 15:36:05 -07:00
profile.ll [ArgumentPromotion]: Copy function metadata after promoting arguments 2020-09-10 13:08:57 -04:00
reserve-tbaa.ll
sret.ll OpaquePtr: Bulk update tests to use typed sret 2020-11-20 17:58:26 -05:00
tail.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
variadic.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00