This is an archive of the discontinued LLVM Phabricator instance.

Debug info for variables whose type is shrinked to bool fix
ClosedPublic

Authored by NikolaPrica on Sep 8 2017, 2:48 AM.

Details

Summary

This patch provides such debug information for integer variables whose type is shrinked to bool by providing dwarf expression which returns either constant initial value or other value.

This patch contains fix for reverted commit rL312318 which was causing failure due to use of unchecked dyn_cast to CIInit.

Diff Detail

Event Timeline

NikolaPrica created this revision.Sep 8 2017, 2:48 AM
vsk added a subscriber: vsk.Sep 8 2017, 5:03 PM

Could you include an IR-based test case?

NikolaPrica retitled this revision from Fix for unchecked dyn_cast in globalot created in rL312318 to Debug info for variables whose type is shrinked to bool fix.
NikolaPrica edited the summary of this revision. (Show Details)
aprantl added inline comments.Sep 12 2017, 8:55 AM
lib/Transforms/IPO/GlobalOpt.cpp
1625

Since this is bound to confuse future readers, it wouldn't hurt to add a line explaining how this expression works.

1648

Why this restriction?

aprantl accepted this revision.Sep 12 2017, 1:08 PM

thanks!

This revision is now accepted and ready to land.Sep 12 2017, 1:08 PM
NikolaPrica closed this revision.Sep 21 2017, 5:03 AM
NikolaPrica added inline comments.
lib/Transforms/IPO/GlobalOpt.cpp
1648

This condition is necessary for examples like:

long a[];
static int b = a;

Previous version of this patch did not check for dyn_cast for CIInit which resulted in failure for the example above.