[Attributor] Allow to reproduce instructions for simplification
authorJohannes Doerfert <johannes@jdoerfert.de>
Fri, 25 Feb 2022 17:36:24 +0000 (11:36 -0600)
committerJohannes Doerfert <johannes@jdoerfert.de>
Mon, 4 Apr 2022 17:28:08 +0000 (12:28 -0500)
commit79962df3866a1e539b7803d3ed696821239ffaaf
tree6bd6ad679f0facc0ad0dd8524b3b89af47198483
parentc2a8a104ec320c8bed39c3632eae2fb37f53487b
[Attributor] Allow to reproduce instructions for simplification

When simplify values we might end up with an instruction from a
different scope or just one that does not dominate the use. If the
instruction can be reproduced without side-effect (incl. UB) we can
now do that. For now this is mostly used for speculatable (intrinsic)
calls but as we learn to make things like arguments or loads available
this will become more powerful.

This will also allow us to remove dead stores more easily in a follow
up.
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Transforms/Attributor/IPConstantProp/return-argument.ll
llvm/test/Transforms/Attributor/value-simplify.ll