Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit bf706a5

Browse files
committed
PNaCl: Strip nonnull attributes from pointer arguments.
R=jfb@chromium.org TEST= (make -C toolchain_build/out/llvm_x86_64_linux_work -j `nproc` check) BUG= Review URL: https://codereview.chromium.org/1042643002
1 parent 7acbb4c commit bf706a5

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/Transforms/NaCl/ReplacePtrsWithInts.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ static AttributeSet RemovePointerAttrs(LLVMContext &Context,
331331
case Attribute::NoAlias:
332332
case Attribute::ReadNone:
333333
case Attribute::ReadOnly:
334+
case Attribute::NonNull:
335+
case Attribute::Dereferenceable:
334336
break;
335337
default:
336338
AB.addAttribute(*Attr);

test/Transforms/NaCl/replace-ptrs-with-ints.ll

+10
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,16 @@ define void @readonly_readnone(i8* readonly readnone) {
490490
}
491491
; CHECK-LABEL: define void @readonly_readnone(i32)
492492

493+
define nonnull i8* @nonnull_ptr(i8* nonnull) {
494+
ret i8* undef
495+
}
496+
; CHECK-LABEL: define i32 @nonnull_ptr(i32)
497+
498+
define dereferenceable(16) i8* @dereferenceable_ptr(i8* dereferenceable(8)) {
499+
ret i8* undef
500+
}
501+
; CHECK-LABEL: define i32 @dereferenceable_ptr(i32)
502+
493503
; "nounwind" should be preserved.
494504
define void @nounwind_func_attr() nounwind {
495505
ret void

0 commit comments

Comments
 (0)