This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][GlobalOpt] Fix -debugify for globalopt shrinking globals to booleans.
ClosedPublic

Authored by rupprecht on Oct 22 2018, 2:39 PM.

Details

Summary

TryToShrinkGlobalToBoolean, when possible, will split store <value> + load <value> into store <bool> + select <bool ? value : 0>. This preserves DebugLoc during that pass.

Fixes PR37959. The test case here is the simplified .ll for:

static int foo;
int bar() {
  foo = 5;
  return foo;
}

Diff Detail

Repository
rL LLVM

Event Timeline

rupprecht created this revision.Oct 22 2018, 2:39 PM
rupprecht retitled this revision from [DebugInfo] Fix -debugify for globalopt shrinking globals to booleans. to [DebugInfo][GlobalOpt] Fix -debugify for globalopt shrinking globals to booleans..Oct 22 2018, 2:42 PM
rupprecht added reviewers: dblaikie, gbedwell, aprantl.
rupprecht added a project: debug-info.
dblaikie accepted this revision.Oct 22 2018, 2:52 PM

Looks good - thanks!

This revision is now accepted and ready to land.Oct 22 2018, 2:52 PM
This revision was automatically updated to reflect the committed changes.