[PATCH] D88207: [ValueTracking] Check uses of Argument if it is given to isGuaranteedNotToBeUndefOrPoison

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 12:43:12 PDT 2020


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LG with some nits



================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4874
 
-static bool programUndefinedIfUndefOrPoison(const Instruction *Inst,
+static bool programUndefinedIfUndefOrPoison(const Value *InstOrArg,
                                             bool PoisonOnly);
----------------
InstOrArg -> V


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:5165
+  if (!isa<Argument>(V) && !isa<Instruction>(V))
+    return false;
+
----------------
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.


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