This is an archive of the discontinued LLVM Phabricator instance.

[CaptureTracking] Ignore ephemeral values when determining pointer escapeness
ClosedPublic

Authored by aeubanks on Apr 5 2022, 3:51 PM.

Details

Summary

Ephemeral values cannot cause a pointer to escape.

No change in compile time:
https://llvm-compile-time-tracker.com/compare.php?from=4371710085ba1c376a094948b806ddd3b88319de&to=c5ddbcc4866f38026737762ee8d7b9b00395d4f4&stat=instructions

This partially fixes some regressions caused by more calls to __builtin_assume (D122397).

Diff Detail

Event Timeline

aeubanks created this revision.Apr 5 2022, 3:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 5 2022, 3:51 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
aeubanks requested review of this revision.Apr 5 2022, 3:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 5 2022, 3:51 PM
aeubanks edited the summary of this revision. (Show Details)Apr 5 2022, 3:52 PM
aeubanks edited the summary of this revision. (Show Details)Apr 5 2022, 3:55 PM
asbirlea accepted this revision.Apr 5 2022, 4:05 PM
This revision is now accepted and ready to land.Apr 5 2022, 4:05 PM

I think doing this is correct.

llvm/include/llvm/Analysis/CaptureTracking.h
18

You can forward declare: template <typename T> class SmallPtrSetImpl;

llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
2196

I believe you need to add it to the pass dependencies below as well.

aeubanks updated this revision to Diff 420932.Apr 6 2022, 9:57 AM

address comments

This revision was landed with ongoing or failed builds.Apr 7 2022, 10:15 AM
This revision was automatically updated to reflect the committed changes.
fhahn added a subscriber: fhahn.Jun 21 2023, 1:18 PM

It looks like this patch may introduced an mis-compile. I put up D153464 which contains a description of the issue + a revert of this change.