[PATCH] D111180: The result of a function with noundef return attribute must be well defined

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 13:36:02 PDT 2021


reames created this revision.
reames added reviewers: nlopes, aqjune.
Herald added subscribers: javed.absar, bollu, hiraditya, mcrosier.
reames requested review of this revision.
Herald added a project: LLVM.

This does for readability of returns within said function as what we do for the caller side when reasoning about what might be poison.

Couldn't figure out a small test.  I'm working on this from SCEV, but that's blocked by other things as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111180

Files:
  llvm/lib/Analysis/ValueTracking.cpp


Index: llvm/lib/Analysis/ValueTracking.cpp
===================================================================
--- llvm/lib/Analysis/ValueTracking.cpp
+++ llvm/lib/Analysis/ValueTracking.cpp
@@ -5418,7 +5418,10 @@
       }
       break;
     }
-
+    case Instruction::Ret:
+      if (I->getFunction()->hasRetAttribute(Attribute::NoUndef))
+        Operands.insert(I->getOperand(0));
+      break;
     default:
       break;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111180.377341.patch
Type: text/x-patch
Size: 431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211005/248cab9e/attachment.bin>


More information about the llvm-commits mailing list