This is an archive of the discontinued LLVM Phabricator instance.

[GlobalOpt] don't hoist constant expressions that can trap
ClosedPublic

Authored by spatel on Aug 26 2021, 10:06 AM.

Details

Summary

We try to forward a stored-once-constant-value from one global access to another, but that's not safe if the constant value is an expression that can trap.
The tests are reduced from the miscompile examples in:
https://llvm.org/PR47578

Diff Detail

Event Timeline

spatel created this revision.Aug 26 2021, 10:06 AM
spatel requested review of this revision.Aug 26 2021, 10:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2021, 10:06 AM
lebedev.ri accepted this revision.Aug 26 2021, 10:13 AM

Yep, that's a standard problem for "constants", and a standard fix.
IMO ConstantExprs should go away.

This revision is now accepted and ready to land.Aug 26 2021, 10:13 AM
jdoerfert accepted this revision.Aug 26 2021, 10:42 AM

I probably need to fix that in the Attributor too..

This revision was landed with ongoing or failed builds.Aug 27 2021, 5:25 AM
This revision was automatically updated to reflect the committed changes.