diff options
author | Philip Reames <listmail@philipreames.com> | 2021-10-06 11:50:51 -0700 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2021-10-06 11:52:18 -0700 |
commit | 67896f494e8a310d561bc88e6890cf5c981ddc73 (patch) | |
tree | 3f1ff2099b1edfc7ee55dbbfa976bb5bc27ca90c /llvm/lib/Analysis/ValueTracking.cpp | |
parent | f53d05135e98535543fd8edd1a0d6e5e4078c8cc (diff) | |
download | llvm-67896f494e8a310d561bc88e6890cf5c981ddc73.zip llvm-67896f494e8a310d561bc88e6890cf5c981ddc73.tar.gz llvm-67896f494e8a310d561bc88e6890cf5c981ddc73.tar.bz2 |
Returning poison from a function w/ noundef return attribute is UB
This does for readability of returns within said function as what we do for the caller side when reasoning about what might be poison.
Differential Revision: https://reviews.llvm.org/D111180
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index a21a7a8..b385810 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -5418,7 +5418,10 @@ void llvm::getGuaranteedWellDefinedOps( } break; } - + case Instruction::Ret: + if (I->getFunction()->hasRetAttribute(Attribute::NoUndef)) + Operands.insert(I->getOperand(0)); + break; default: break; } |