This is an archive of the discontinued LLVM Phabricator instance.

ConstantFolding: Guard use of getFunction
ClosedPublic

Authored by dstuttard on Nov 24 2022, 1:27 AM.

Details

Summary

Add additional guards for a use of getFunction on an Instruction
In some cases constanfFoldCanonicalize can be called with a cloned instruction
that doesn't have a parent (or associated function), causing a seg fault.

Diff Detail

Event Timeline

dstuttard created this revision.Nov 24 2022, 1:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 24 2022, 1:27 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
dstuttard requested review of this revision.Nov 24 2022, 1:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 24 2022, 1:27 AM

Managed to get arc diff to work!

arsenm accepted this revision.Nov 28 2022, 11:46 AM

Seems a bit broken that this is reachable. Unit test would be nice

This revision is now accepted and ready to land.Nov 28 2022, 11:46 AM
arsenm requested changes to this revision.Nov 28 2022, 11:49 AM

Actually, this shows there's a bug here. getFunction shouldn't be relevant The call below should be looking at the parent function

This revision now requires changes to proceed.Nov 28 2022, 11:49 AM
arsenm accepted this revision.Nov 28 2022, 11:51 AM

getFunction is not getCalledFunction

This revision is now accepted and ready to land.Nov 28 2022, 11:51 AM
This revision was automatically updated to reflect the committed changes.