Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions llvm/test/tools/llvm-reduce/operands-to-args-target-ext-type.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
; RUN: llvm-reduce %s -o %t --abort-on-invalid-reduction --delta-passes=operands-to-args --test FileCheck --test-arg %s --test-arg --check-prefixes=INTERESTING --test-arg --input-file
; RUN: FileCheck %s --input-file %t --check-prefixes=RESULT

; Make sure there's no assert from trying to create a
; not-zeroinitializable target ext type


declare void @uses_ext_ty(target("sometarget.sometype"))
declare target("sometarget.sometype") @produces_ext_ty()

; INTERESTING: define void @not_zero_foldable(

; RESULT: define void @not_zero_foldable(target("sometarget.sometype") %call) {
; RESULT-NEXT: %call1 = call target("sometarget.sometype") @produces_ext_ty()
; RESULT-NEXT: call void @uses_ext_ty(target("sometarget.sometype") %call)
define void @not_zero_foldable() {
%call = call target("sometarget.sometype") @produces_ext_ty()
call void @uses_ext_ty(target("sometarget.sometype") %call)
ret void
}

declare void @uses_zeroinit_ext_ty(target("spirv.zeroinit"))
declare target("sometarget.sometype") @produces_zeroinit_ext_ty()

; INTERESTING: define void @foldable_to_zero(
; RESULT: define void @foldable_to_zero(target("spirv.zeroinit") %call) {
define void @foldable_to_zero() {
%call = call target("spirv.zeroinit") @produces_zeroinit_ext_ty()
call void @uses_zeroinit_ext_ty(target("spirv.zeroinit") %call)
ret void
}

13 changes: 13 additions & 0 deletions llvm/test/tools/llvm-reduce/reduce-args-target-ext-ty.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; RUN: llvm-reduce %s -o %t --abort-on-invalid-reduction --delta-passes=arguments --test FileCheck --test-arg %s --test-arg --check-prefixes=INTERESTING --test-arg --input-file
; RUN: FileCheck %s --input-file %t --check-prefixes=RESULT

declare void @uses_ext_ty(target("sometarget.sometype"))
declare target("sometarget.sometype") @produces_ext_ty()

; INTERESTING: @interesting(
; RESULT: @interesting(
; RESULT: void @uses_ext_ty()
define void @interesting(target("sometarget.sometype") %arg) {
call void @uses_ext_ty(target("sometarget.sometype") %arg)
ret void
}
11 changes: 10 additions & 1 deletion llvm/tools/llvm-reduce/deltas/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ cl::opt<bool> llvm::Verbose("verbose",
cl::init(false), cl::cat(LLVMReduceOptions));

Value *llvm::getDefaultValue(Type *T) {
return T->isVoidTy() ? PoisonValue::get(T) : Constant::getNullValue(T);
if (T->isVoidTy())
return PoisonValue::get(T);

if (auto *TET = dyn_cast<TargetExtType>(T)) {
if (TET->hasProperty(TargetExtType::HasZeroInit))
return ConstantTargetNone::get(TET);
return PoisonValue::get(TET);
}

return Constant::getNullValue(T);
}

bool llvm::hasAliasUse(Function &F) {
Expand Down
Loading