File tree Expand file tree Collapse file tree 4 files changed +27
-2
lines changed Expand file tree Collapse file tree 4 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 4
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
5
; RUN: FileCheck --check-prefixes=CHECK,ONE %s < %t
6
6
7
+ ; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=operands-poison --test FileCheck --test-arg %s --test-arg --input-file %s -o %t
8
+ ; RUN: FileCheck --check-prefixes=CHECK,POISON %s < %t
9
+
7
10
declare void @uses_ext_ty (target ("sometarget.sometype" ))
8
11
9
12
; TODO: Should support reduce to poison
10
13
; CHECK-LABEL: @foo(
11
14
; ZERO: call void @uses_ext_ty(target("sometarget.sometype") %arg)
12
15
; ONE: call void @uses_ext_ty(target("sometarget.sometype") %arg)
16
+ ; POISON: call void @uses_ext_ty(target("sometarget.sometype") poison)
13
17
define void @foo (target ("sometarget.sometype" ) %arg ) {
14
18
call void @uses_ext_ty (target ("sometarget.sometype" ) %arg )
15
19
ret void
@@ -20,6 +24,7 @@ declare void @uses_zeroinit_ext_ty(target("sometarget.sometype"))
20
24
; CHECK-LABEL: @bar(
21
25
; ZERO: call void @uses_zeroinit_ext_ty(target("spirv.sometype") zeroinitializer)
22
26
; ONE: call void @uses_zeroinit_ext_ty(target("spirv.sometype") %arg)
27
+ ; POISON: call void @uses_zeroinit_ext_ty(target("spirv.sometype") poison)
23
28
define void @bar (target ("spirv.sometype" ) %arg ) {
24
29
call void @uses_zeroinit_ext_ty (target ("spirv.sometype" ) %arg )
25
30
ret void
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ static cl::list<std::string>
104
104
DELTA_PASS (" operands-zero" , reduceOperandsZeroDeltaPass) \
105
105
DELTA_PASS (" operands-one" , reduceOperandsOneDeltaPass) \
106
106
DELTA_PASS (" operands-nan" , reduceOperandsNaNDeltaPass) \
107
+ DELTA_PASS (" operands-poison" , reduceOperandsPoisonDeltaPass) \
107
108
DELTA_PASS (" operands-to-args" , reduceOperandsToArgsDeltaPass) \
108
109
DELTA_PASS (" operands-skip" , reduceOperandsSkipDeltaPass) \
109
110
DELTA_PASS (" operand-bundles" , reduceOperandBundesDeltaPass) \
Original file line number Diff line number Diff line change @@ -140,8 +140,6 @@ void llvm::reduceOperandsZeroDeltaPass(TestRunner &Test) {
140
140
return nullptr ;
141
141
if (TET->hasProperty (TargetExtType::HasZeroInit))
142
142
return ConstantTargetNone::get (TET);
143
-
144
- // TODO: Poison reduction for this case
145
143
return nullptr ;
146
144
}
147
145
@@ -183,3 +181,23 @@ void llvm::reduceOperandsNaNDeltaPass(TestRunner &Test) {
183
181
},
184
182
" Reducing Operands to NaN" );
185
183
}
184
+
185
+ void llvm::reduceOperandsPoisonDeltaPass (TestRunner &Test) {
186
+ auto ReduceValue = [](Use &Op) -> Value * {
187
+ Type *Ty = Op->getType ();
188
+ if (auto *TET = dyn_cast<TargetExtType>(Ty)) {
189
+ if (isa<ConstantTargetNone, PoisonValue>(Op))
190
+ return nullptr ;
191
+ return PoisonValue::get (TET);
192
+ }
193
+
194
+ return nullptr ;
195
+ };
196
+
197
+ runDeltaPass (
198
+ Test,
199
+ [ReduceValue](Oracle &O, ReducerWorkItem &Program) {
200
+ extractOperandsFromModule (O, Program, ReduceValue);
201
+ },
202
+ " Reducing Operands to poison" );
203
+ }
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ namespace llvm {
15
15
void reduceOperandsOneDeltaPass (TestRunner &Test);
16
16
void reduceOperandsZeroDeltaPass (TestRunner &Test);
17
17
void reduceOperandsNaNDeltaPass (TestRunner &Test);
18
+ void reduceOperandsPoisonDeltaPass (TestRunner &Test);
18
19
} // namespace llvm
19
20
20
21
#endif
You can’t perform that action at this time.
0 commit comments