aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
authorJohannes Doerfert <johannes@jdoerfert.de>2020-09-08 10:13:11 -0500
committerJohannes Doerfert <johannes@jdoerfert.de>2020-10-05 23:23:06 -0500
commitef48436e62732e61cea5dde9b35b63b3ce8126f7 (patch)
treea905f987a82bf835bdc39ac2d320519ba71c6ef9 /llvm/lib/IR/Attributes.cpp
parent2a078c3072043541ee0595aea6c8d7909f94c6f9 (diff)
downloadllvm-ef48436e62732e61cea5dde9b35b63b3ce8126f7.zip
llvm-ef48436e62732e61cea5dde9b35b63b3ce8126f7.tar.gz
llvm-ef48436e62732e61cea5dde9b35b63b3ce8126f7.tar.bz2
[AttributeFuncs] Consider `noundef` in `typeIncompatible`
Drop `noundef` for return values that are replaced by void and make it illegal to put `noundef` on a void value. Reviewed By: fhahn Differential Revision: https://reviews.llvm.org/D87306
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r--llvm/lib/IR/Attributes.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index ecb0bd69..b21d452 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -1859,6 +1859,10 @@ AttrBuilder AttributeFuncs::typeIncompatible(Type *Ty) {
.addByValAttr(Ty)
.addByRefAttr(Ty);
+ // Some attributes can apply to all "values" but there are no `void` values.
+ if (Ty->isVoidTy())
+ Incompatible.addAttribute(Attribute::NoUndef);
+
return Incompatible;
}