[PATCH] D76010: [ValueTracking] Let isGuaranteedNotToBeUndefOrPoison look into more constants/instructions

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 16 15:51:58 PDT 2020


reames requested changes to this revision.
reames added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4573
 
   if (auto PN = dyn_cast<PHINode>(V)) {
     if (llvm::all_of(PN->incoming_values(), [](const Use &U) {
----------------
We should have the same recursion here with the depth limit to handle cycles.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4586
+  if (auto FI = dyn_cast<FCmpInst>(V)) {
+    if (FI->getFastMathFlags().none() && llvm::all_of(FI->operands(), OpCheck))
       return true;
----------------
As a follow up, it would be nice to re-write this in terms of existing logic.  For example, the operand handling part can be done as:
if (propagatesFullPoison(&I) && std::all_of(I.operands(), OpCheck)) return true;

You do need to filter instructions with poison producing flags above that.  For that, you could possible factor out a function "localProducesPoison(Op)" based on the function generatePoisonChecks from PoisonChecking.cpp

This is optional follow on.  


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76010/new/

https://reviews.llvm.org/D76010





More information about the llvm-commits mailing list