This is an archive of the discontinued LLVM Phabricator instance.

[LVI] Look through extractvalue of insertvalue
ClosedPublic

Authored by nikic on Aug 31 2019, 3:07 AM.

Details

Summary

This addresses the issue mentioned on D19867. When we simplify with.overflow instructions in CVP, we leave behind extractvalue of insertvalue sequences that LVI no longer understands. This means that we can not simplify any instructions based on the with.overflow anymore (until some over pass like InstCombine cleans them up).

This patch extends LVI extractvalue handling by calling SimplifyExtractValueInst (which doesn't do anything more than constant folding + looking through insertvalue) and using the block value of the simplification.

A possible alternative would be to do something similar to SimplifyIndVars, where we instead directly try to replace extractvalue users of the with.overflow. This would need some some additional structural changes to CVP, as it's currently not legal to remove anything but the current instruction -- we'd have to introduce a worklist with instructions scheduled for deletion or similar.

Diff Detail

Repository
rL LLVM

Event Timeline

nikic created this revision.Aug 31 2019, 3:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2019, 3:07 AM
lebedev.ri accepted this revision.Aug 31 2019, 4:21 AM

Looks good to me, but you might want to wait for @reames / @spatel a bit.

This revision is now accepted and ready to land.Aug 31 2019, 4:21 AM
This revision was automatically updated to reflect the committed changes.