File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ ; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=operands-zero --test FileCheck --test-arg %s --test-arg --input-file %s -o %t
2
+ ; RUN: FileCheck --check-prefixes=CHECK,ZERO %s < %t
3
+
4
+ ; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=operands-one --test FileCheck --test-arg %s --test-arg --input-file %s -o %t
5
+ ; RUN: FileCheck --check-prefixes=CHECK,ONE %s < %t
6
+
7
+ declare void @uses_ext_ty (target ("sometarget.sometype" ))
8
+
9
+ ; TODO: Should support reduce to poison
10
+ ; CHECK-LABEL: @foo(
11
+ ; ZERO: call void @uses_ext_ty(target("sometarget.sometype") %arg)
12
+ ; ONE: call void @uses_ext_ty(target("sometarget.sometype") %arg)
13
+ define void @foo (target ("sometarget.sometype" ) %arg ) {
14
+ call void @uses_ext_ty (target ("sometarget.sometype" ) %arg )
15
+ ret void
16
+ }
17
+
18
+ declare void @uses_zeroinit_ext_ty (target ("sometarget.sometype" ))
19
+
20
+ ; CHECK-LABEL: @bar(
21
+ ; ZERO: call void @uses_zeroinit_ext_ty(target("spirv.sometype") zeroinitializer)
22
+ ; ONE: call void @uses_zeroinit_ext_ty(target("spirv.sometype") %arg)
23
+ define void @bar (target ("spirv.sometype" ) %arg ) {
24
+ call void @uses_zeroinit_ext_ty (target ("spirv.sometype" ) %arg )
25
+ ret void
26
+ }
Original file line number Diff line number Diff line change @@ -134,6 +134,17 @@ void llvm::reduceOperandsZeroDeltaPass(TestRunner &Test) {
134
134
if (auto *IntTy = dyn_cast<IntegerType>(Op->getType ()))
135
135
if (switchCaseExists (Op, ConstantInt::get (IntTy, 0 )))
136
136
return nullptr ;
137
+
138
+ if (auto *TET = dyn_cast<TargetExtType>(Op->getType ())) {
139
+ if (isa<ConstantTargetNone, PoisonValue>(Op))
140
+ return nullptr ;
141
+ if (TET->hasProperty (TargetExtType::HasZeroInit))
142
+ return ConstantTargetNone::get (TET);
143
+
144
+ // TODO: Poison reduction for this case
145
+ return nullptr ;
146
+ }
147
+
137
148
// Don't replace existing zeroes.
138
149
return isZero (Op) ? nullptr : Constant::getNullValue (Op->getType ());
139
150
};
You can’t perform that action at this time.
0 commit comments