This is an archive of the discontinued LLVM Phabricator instance.

[IROutliner] Strip loop info when moving code into outlined function.
ClosedPublic

Authored by AndrewLitteken on Mar 2 2022, 10:10 PM.

Details

Summary

As pointed out in https://github.com/llvm/llvm-project/issues/54155#issuecomment-1057465479, there was a crash when loop info was being outlined. It was not being properly stripped and adjusted, so would point to the wrong location. This uses similar logic found in the CodeExtractor to adjust the loop debug info.

Diff Detail

Event Timeline

AndrewLitteken created this revision.Mar 2 2022, 10:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2022, 10:10 PM
AndrewLitteken requested review of this revision.Mar 2 2022, 10:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2022, 10:10 PM
fhahn added a subscriber: fhahn.Mar 3 2022, 4:12 AM
fhahn added inline comments.
llvm/test/Transforms/IROutliner/outlining-strip-loop-info.ll
13

Is all the complexity needed in the test case? IIUC it would be sufficient to have a function with a simple outline-able loop + !llvm.loop metadata with debug info.

Just verified that this resolves the crash in the benchmark on my end.

I agree that this test case can be simplified. After that, I think this is good to go.

ormris removed a subscriber: ormris.Mar 7 2022, 9:55 AM

Reducing test case

This testcase is better, but there are still lots of instructions which aren't necessary.

How about this:

https://godbolt.org/z/r8Gq7vdbx

?

This revision was not accepted when it landed; it landed in state Needs Review.Mar 17 2022, 1:43 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.