This is an archive of the discontinued LLVM Phabricator instance.

[llvm] Ensure InlineCost-related fields are initialized
ClosedPublic

Authored by mtrofin on Jan 25 2020, 10:43 AM.

Details

Summary

Small fix - never hurts to have things initialized.

Diff Detail

Event Timeline

mtrofin created this revision.Jan 25 2020, 10:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 25 2020, 10:43 AM
davidxl added inline comments.Jan 28 2020, 10:03 AM
llvm/include/llvm/Analysis/InlineCost.h
163

why is 0 a meaningful default value to start with?

mtrofin marked an inline comment as done.Jan 28 2020, 11:41 AM
mtrofin added inline comments.
llvm/include/llvm/Analysis/InlineCost.h
163

My goal was to ensure the fields are initialized, to avoid nasty-to-debug uninitialized value bugs; so I picked 0 as the natural thing to initialize with. Happy to change to a different value.

davidxl added inline comments.Jan 28 2020, 12:03 PM
llvm/include/llvm/Analysis/InlineCost.h
163

how about initializing it to some illegal value such as -1 to indicate it is not logically initialized

mtrofin updated this revision to Diff 240968.Jan 28 2020, 12:15 PM

Initializing DefaultThreshold to -1.

This revision is now accepted and ready to land.Jan 28 2020, 12:27 PM
This revision was automatically updated to reflect the committed changes.