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 44; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=operands-one --test FileCheck --test-arg %s --test-arg --input-file %s -o %t
55; RUN: FileCheck --check-prefixes=CHECK,ONE %s < %t
66
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+
710declare void @uses_ext_ty (target ("sometarget.sometype" ))
811
912; TODO: Should support reduce to poison
1013; CHECK-LABEL: @foo(
1114; ZERO: call void @uses_ext_ty(target("sometarget.sometype") %arg)
1215; ONE: call void @uses_ext_ty(target("sometarget.sometype") %arg)
16+ ; POISON: call void @uses_ext_ty(target("sometarget.sometype") poison)
1317define void @foo (target ("sometarget.sometype" ) %arg ) {
1418 call void @uses_ext_ty (target ("sometarget.sometype" ) %arg )
1519 ret void
@@ -20,6 +24,7 @@ declare void @uses_zeroinit_ext_ty(target("sometarget.sometype"))
2024; CHECK-LABEL: @bar(
2125; ZERO: call void @uses_zeroinit_ext_ty(target("spirv.sometype") zeroinitializer)
2226; ONE: call void @uses_zeroinit_ext_ty(target("spirv.sometype") %arg)
27+ ; POISON: call void @uses_zeroinit_ext_ty(target("spirv.sometype") poison)
2328define void @bar (target ("spirv.sometype" ) %arg ) {
2429 call void @uses_zeroinit_ext_ty (target ("spirv.sometype" ) %arg )
2530 ret void
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ static cl::list<std::string>
104104 DELTA_PASS (" operands-zero" , reduceOperandsZeroDeltaPass) \
105105 DELTA_PASS (" operands-one" , reduceOperandsOneDeltaPass) \
106106 DELTA_PASS (" operands-nan" , reduceOperandsNaNDeltaPass) \
107+ DELTA_PASS (" operands-poison" , reduceOperandsPoisonDeltaPass) \
107108 DELTA_PASS (" operands-to-args" , reduceOperandsToArgsDeltaPass) \
108109 DELTA_PASS (" operands-skip" , reduceOperandsSkipDeltaPass) \
109110 DELTA_PASS (" operand-bundles" , reduceOperandBundesDeltaPass) \
Original file line number Diff line number Diff line change @@ -140,8 +140,6 @@ void llvm::reduceOperandsZeroDeltaPass(TestRunner &Test) {
140140 return nullptr ;
141141 if (TET->hasProperty (TargetExtType::HasZeroInit))
142142 return ConstantTargetNone::get (TET);
143-
144- // TODO: Poison reduction for this case
145143 return nullptr ;
146144 }
147145
@@ -183,3 +181,23 @@ void llvm::reduceOperandsNaNDeltaPass(TestRunner &Test) {
183181 },
184182 " Reducing Operands to NaN" );
185183}
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 {
1515void reduceOperandsOneDeltaPass (TestRunner &Test);
1616void reduceOperandsZeroDeltaPass (TestRunner &Test);
1717void reduceOperandsNaNDeltaPass (TestRunner &Test);
18+ void reduceOperandsPoisonDeltaPass (TestRunner &Test);
1819} // namespace llvm
1920
2021#endif
You can’t perform that action at this time.
0 commit comments