This is an archive of the discontinued LLVM Phabricator instance.

freeze does not change the constant property
ClosedPublic

Authored by danilaml on Jun 14 2022, 7:45 AM.

Details

Summary

Traverse through freeze when checking if base is constant

Diff Detail

Event Timeline

danilaml created this revision.Jun 14 2022, 7:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2022, 7:45 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
danilaml requested review of this revision.Jun 14 2022, 7:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2022, 7:45 AM
skatkov accepted this revision.Jun 14 2022, 7:52 AM

lgtm

This revision is now accepted and ready to land.Jun 14 2022, 7:52 AM

Non blocking comment..

freeze(undef) being equally null or base as undef seems questionable to me. I think in practice it might work out okay, but there's no guarantee that the value chosen for undef isn't 0 when frozen, and 1 when not. You might want to step back and take a deeper look at the problem you're solving here.

Non blocking comment..

freeze(undef) being equally null or base as undef seems questionable to me. I think in practice it might work out okay, but there's no guarantee that the value chosen for undef isn't 0 when frozen, and 1 when not. You might want to step back and take a deeper look at the problem you're solving here.

Hm, I don't see how the value eventually chosen for freeze/undef factor into this verifier check. It doesn't try to guess/resolve undef/poison in any way, so it should be conservative here by only treating them as some constants (isa<Constant>(V) is true for them). In other words, if the value is already exclusively null (=> not undef or poison), "freezing" it won't change that property (so it's safe to look through it). Similarly, if it's already a constant (including undef or poison). Or maybe I'm approaching it wrong?

This revision was landed with ongoing or failed builds.Jun 14 2022, 9:53 AM
This revision was automatically updated to reflect the committed changes.