[PATCH] D87306: [AttributeFuncs] Consider `noundef` in `typeIncompatible`
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 13:19:07 PDT 2020
jdoerfert updated this revision to Diff 290817.
jdoerfert added a comment.
Rebase on top of D87304 <https://reviews.llvm.org/D87304>
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87306/new/
https://reviews.llvm.org/D87306
Files:
llvm/lib/IR/Attributes.cpp
llvm/test/Transforms/DeadArgElim/returned.ll
llvm/test/Verifier/align.ll
llvm/test/Verifier/noundef.ll
Index: llvm/test/Verifier/noundef.ll
===================================================================
--- /dev/null
+++ llvm/test/Verifier/noundef.ll
@@ -0,0 +1,7 @@
+; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
+
+; CHECK: Wrong types for attribute: inalloca nest noalias nocapture noundef nonnull readnone readonly signext sret zeroext byref(void) byval(void) preallocated(void) align 1 dereferenceable(1) dereferenceable_or_null(1)
+; CHECK-NEXT: @noundef_void
+define noundef void @noundef_void() {
+ ret void
+}
Index: llvm/test/Verifier/align.ll
===================================================================
--- llvm/test/Verifier/align.ll
+++ llvm/test/Verifier/align.ll
@@ -6,7 +6,7 @@
ret void
}
-; CHECK: Wrong types for attribute: inalloca nest noalias nocapture nonnull readnone readonly signext sret zeroext byref(void) byval(void) preallocated(void) align 1 dereferenceable(1) dereferenceable_or_null(1)
+; CHECK: Wrong types for attribute: inalloca nest noalias nocapture noundef nonnull readnone readonly signext sret zeroext byref(void) byval(void) preallocated(void) align 1 dereferenceable(1) dereferenceable_or_null(1)
; CHECK-NEXT: @align_non_pointer2
define align 4 void @align_non_pointer2(i32 %a) {
ret void
Index: llvm/test/Transforms/DeadArgElim/returned.ll
===================================================================
--- llvm/test/Transforms/DeadArgElim/returned.ll
+++ llvm/test/Transforms/DeadArgElim/returned.ll
@@ -45,7 +45,7 @@
; Drop all these attributes
; CHECK-LABEL: define internal void @test6
-define internal align 8 dereferenceable_or_null(2) noalias i8* @test6() {
+define internal align 8 dereferenceable_or_null(2) noundef noalias i8* @test6() {
ret i8* null
}
Index: llvm/lib/IR/Attributes.cpp
===================================================================
--- llvm/lib/IR/Attributes.cpp
+++ llvm/lib/IR/Attributes.cpp
@@ -1859,6 +1859,10 @@
.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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87306.290817.patch
Type: text/x-patch
Size: 2185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200909/1c4b6d32/attachment-0001.bin>
More information about the llvm-commits
mailing list