This does for readability of returns within said function as what we do for the caller side when reasoning about what might be poison.
Couldn't figure out a small test. I'm working on this from SCEV, but that's blocked by other things as well.
Paths
| Differential D111180
The result of a function with noundef return attribute must be well defined ClosedPublic Authored by reames on Oct 5 2021, 1:36 PM.
Details Summary This does for readability of returns within said function as what we do for the caller side when reasoning about what might be poison. Couldn't figure out a small test. I'm working on this from SCEV, but that's blocked by other things as well.
Diff Detail
Event TimelineHerald added subscribers: javed.absar, bollu, hiraditya, mcrosier. · View Herald TranscriptOct 5 2021, 1:36 PM Comment Actions If nothing else you could add a unit test, see programUndefinedIfPoison/isGuaranteedNotToBePoison tests in ValueTrackingTest.
Comment Actions Added D111186 as a dependency. Will rebase over updated tests once I can exercise this from SCEV. Comment Actions Add tests - key detail is that removing udiv no-longer has any effect as noimplicit defs serves as a immediate UB root. This revision is now accepted and ready to land.Oct 6 2021, 11:39 AM This revision was landed with ongoing or failed builds.Oct 6 2021, 11:52 AM Closed by commit rG67896f494e8a: Returning poison from a function w/ noundef return attribute is UB (authored by reames). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 377629 llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll
|
This should guard against void returns, in which case getOperand(0) would assert.