This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Fix SimplifyLibCalls erasing an instruction while IC still had references to it
ClosedPublic

Authored by aemerson on Oct 1 2018, 9:17 AM.

Details

Summary

InstCombine keeps a worklist and assumes that optimizations don't eraseFromParent() the instruction, which SimplifyLibCalls violates. This change adds a new callback to SimplifyLibCalls to let clients specify their own hander for erasing actions.

Diff Detail

Repository
rL LLVM

Event Timeline

aemerson created this revision.Oct 1 2018, 9:17 AM
spatel added inline comments.Oct 9 2018, 7:46 AM
include/llvm/Transforms/Utils/SimplifyLibCalls.h
105 ↗(On Diff #167750)

This will fail at link time if a client has not provided the function? Isn't it better to just require this param (and the existing RAUW)?

aemerson added inline comments.Oct 11 2018, 7:34 AM
include/llvm/Transforms/Utils/SimplifyLibCalls.h
105 ↗(On Diff #167750)

Yeah I did think it was a bit odd that the default implementation for the RAUW was removed at some point (it was there when the callback was originally added). I'll add them in.

aemerson updated this revision to Diff 169207.Oct 11 2018, 7:45 AM
spatel accepted this revision.Oct 11 2018, 7:48 AM

LGTM

This revision is now accepted and ready to land.Oct 11 2018, 7:48 AM
This revision was automatically updated to reflect the committed changes.