This is an archive of the discontinued LLVM Phabricator instance.

[FuncSpec] Conditional jump or move depends on uninitialised value(s).
ClosedPublic

Authored by labrinea on Apr 20 2022, 12:01 PM.

Details

Summary

I found this bug when performing a two-stage build of clang with Function Specialization enabled and tuned aggressively. The crash appears only on release builds. Fixes https://github.com/llvm/llvm-project/issues/55000.

Before accessing the contents of the Argument iterator inside SCCPInstVisitor::markArgInFuncSpecialization, we should be checking that the iterator is valid.

Diff Detail

Event Timeline

labrinea created this revision.Apr 20 2022, 12:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2022, 12:01 PM
labrinea requested review of this revision.Apr 20 2022, 12:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2022, 12:01 PM
labrinea updated this revision to Diff 423994.Apr 20 2022, 12:29 PM
labrinea edited the summary of this revision. (Show Details)

The test is not good. It looks it comes from the actual failure cases. We should try to find a reduced example.

fhahn added a subscriber: fhahn.Apr 21 2022, 1:29 AM

Also please elaborate in the patch description what the issue is and *why* using TrackingVH is the best fix.

Thank you both for the feedback. I'll investigate further as I think there's more to it. I've added some additional info in https://github.com/llvm/llvm-project/issues/55000#issuecomment-1105169299. Cheers.

labrinea updated this revision to Diff 425234.Apr 26 2022, 9:14 AM
labrinea retitled this revision from [FuncSpec] Assertion in Value::doRAUW to [FuncSpec] Conditional jump or move depends on uninitialised value(s)..
labrinea edited the summary of this revision. (Show Details)

Changes to prior revision:

  • added a validity check before accessing the contents of iterator
  • reduced the testcase
ChuanqiXu accepted this revision.Apr 26 2022, 7:33 PM

Now it looks good to me.

This revision is now accepted and ready to land.Apr 26 2022, 7:33 PM
This revision was landed with ongoing or failed builds.Apr 26 2022, 11:29 PM
This revision was automatically updated to reflect the committed changes.