mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[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
This commit is contained in:
parent
5dc5457fbf
commit
e6334e7ecd
@ -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;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ define internal %Ty* @test5(%Ty* %this) {
|
||||
|
||||
; 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
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ define void @align_non_pointer1(i32 align 4 %a) {
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: Wrong types for attribute: inalloca nest noalias nocapture nonnull readnone readonly signext zeroext byref(void) byval(void) preallocated(void) sret(void) align 1 dereferenceable(1) dereferenceable_or_null(1)
|
||||
; CHECK: Wrong types for attribute: inalloca nest noalias nocapture noundef nonnull readnone readonly signext zeroext byref(void) byval(void) preallocated(void) sret(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
|
||||
|
7
test/Verifier/noundef.ll
Normal file
7
test/Verifier/noundef.ll
Normal file
@ -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 zeroext byref(void) byval(void) preallocated(void) sret(void) align 1 dereferenceable(1) dereferenceable_or_null(1)
|
||||
; CHECK-NEXT: @noundef_void
|
||||
define noundef void @noundef_void() {
|
||||
ret void
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user