This is an archive of the discontinued LLVM Phabricator instance.

[CodeExtractor] Use 'normal destination' BB as insert point to store invoke results.
ClosedPublic

Authored by fhahn on Aug 21 2018, 7:19 AM.

Details

Summary

Currently CodeExtractor tries to use the next node after an invoke to
place the store for the result of the invoke, if it is an out parameter
of the region. This fails, as the invoke terminates the current BB.
In that case, we can place the store in the 'normal destination' BB, as
the result will only be available in that case.

Diff Detail

Repository
rL LLVM

Event Timeline

fhahn created this revision.Aug 21 2018, 7:19 AM
davidxl added inline comments.Aug 21 2018, 9:37 AM
lib/Transforms/Utils/CodeExtractor.cpp
933 ↗(On Diff #161713)

Perhaps merge it as:

Instruction InsertPt;
if (auto *Invoke = ...)

InsertPt = ...

else

InsertPt = OutI->getNextNode();
fhahn updated this revision to Diff 161747.Aug 21 2018, 9:41 AM
fhahn marked an inline comment as done.

Merged if as suggested, thanks!

davidxl accepted this revision.Aug 21 2018, 9:43 AM

lgtm

This revision is now accepted and ready to land.Aug 21 2018, 9:43 AM
This revision was automatically updated to reflect the committed changes.