[PATCH] D88207: [ValueTracking] Check uses of Argument if it is given to isGuaranteedNotToBeUndefOrPoison
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 17:03:19 PDT 2020
aqjune added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:5165
+ if (!isa<Argument>(V) && !isa<Instruction>(V))
+ return false;
+
----------------
nikic wrote:
> nikic wrote:
> > aqjune wrote:
> > > Unit tests say V can be MetadataAsValue as well (that is called from AANoUndefImpl::initialize).
> > > But, does it imply that AANoUndefImpl::initialize should be fixed?
> > I think it would be more elegant to write
> > ```
> > } else if (auto *Arg = dyn_cast<Argument>(V)) {
> > // ...
> > } else {
> > return false;
> > }
> > ```
> > below, rather than having having to keep the checks here and below in sync.
> > Unit tests say V can be MetadataAsValue as well (that is called from AANoUndefImpl::initialize).
> > But, does it imply that AANoUndefImpl::initialize should be fixed?
>
> I don't think there's anything wrong with. It shouldn't cause issues for this code as implemented, right?
It happened because there was a function call that had a metadata as its argument, and AANoUndefImpl was somehow trying to work with the metadata argument.
Yes, I think AANoUndefImpl is okay. I feel it might be safe for isGuaranteedNotToBeUndefOrPoison to simply return false when MetadataAsValue is given, to make possible future changes assertion-safe.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88207/new/
https://reviews.llvm.org/D88207
More information about the llvm-commits
mailing list