Skip to content

Commit a8cc507

Browse files
committed
Remove combine logic
1 parent 59a800d commit a8cc507

File tree

2 files changed

+3
-59
lines changed

2 files changed

+3
-59
lines changed

llvm/include/llvm/Target/GlobalISel/Combine.td

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,6 @@ def binop_right_undef_to_undef: GICombineRule<
430430
[{ return Helper.matchOperandIsUndef(*${root}, 2); }]),
431431
(apply [{ Helper.replaceInstWithUndef(*${root}); }])>;
432432

433-
def binop_right_poison_to_poison
434-
: GICombineRule<(defs root:$root),
435-
(match(wip_match_opcode G_SHL, G_ASHR, G_LSHR):$root,
436-
[{ return Helper.matchOperandIsPoison(*${root}, 2); }]),
437-
(apply [{ Helper.replaceInstWithPoison(*${root}); }])>;
438-
439433
def unary_undef_to_zero: GICombineRule<
440434
(defs root:$root),
441435
(match (wip_match_opcode G_ABS):$root,
@@ -453,17 +447,6 @@ def unary_undef_to_undef : GICombineRule<
453447
(match (unary_undef_to_undef_frags $dst)),
454448
(apply [{ Helper.replaceInstWithUndef(*${dst}.getParent()); }])>;
455449

456-
def unary_poison_to_poison_frags
457-
: GICombinePatFrag<(outs root:$dst), (ins),
458-
!foreach(op,
459-
[G_TRUNC, G_BITCAST, G_ANYEXT, G_PTRTOINT,
460-
G_INTTOPTR, G_FPTOSI, G_FPTOUI],
461-
(pattern(op $dst, $x), (G_POISON $x)))>;
462-
def unary_poison_to_poison
463-
: GICombineRule<
464-
(defs root:$dst), (match(unary_poison_to_poison_frags $dst)),
465-
(apply [{ Helper.replaceInstWithPoison(*${dst}.getParent()); }])>;
466-
467450
// Instructions where if any source operand is undef, the instruction can be
468451
// replaced with undef.
469452
def propagate_undef_any_op: GICombineRule<
@@ -472,15 +455,6 @@ def propagate_undef_any_op: GICombineRule<
472455
[{ return Helper.matchAnyExplicitUseIsUndef(*${root}); }]),
473456
(apply [{ Helper.replaceInstWithUndef(*${root}); }])>;
474457

475-
// Instructions where if any source operand is poison, the instruction can be
476-
// replaced with poison.
477-
def propagate_poison_any_op
478-
: GICombineRule<
479-
(defs root:$root),
480-
(match(wip_match_opcode G_ADD, G_SUB, G_XOR):$root,
481-
[{ return Helper.matchAnyExplicitUseIsPoison(*${root}); }]),
482-
(apply [{ Helper.replaceInstWithPoison(*${root}); }])>;
483-
484458
// Instructions where if all source operands are undef, the instruction can be
485459
// replaced with undef.
486460
def propagate_undef_all_ops: GICombineRule<
@@ -489,15 +463,6 @@ def propagate_undef_all_ops: GICombineRule<
489463
[{ return Helper.matchAllExplicitUsesAreUndef(*${root}); }]),
490464
(apply [{ Helper.replaceInstWithUndef(*${root}); }])>;
491465

492-
// Instructions where if all source operands are poison, the instruction can be
493-
// replaced with poison.
494-
def propagate_poison_all_ops
495-
: GICombineRule<
496-
(defs root:$root),
497-
(match(wip_match_opcode G_SHUFFLE_VECTOR, G_BUILD_VECTOR):$root,
498-
[{ return Helper.matchAllExplicitUsesArePoison(*${root}); }]),
499-
(apply [{ Helper.replaceInstWithPoison(*${root}); }])>;
500-
501466
// Replace a G_SHUFFLE_VECTOR with an undef mask with a G_IMPLICIT_DEF.
502467
def propagate_undef_shuffle_mask: GICombineRule<
503468
(defs root:$root),
@@ -689,13 +654,6 @@ def erase_undef_store : GICombineRule<
689654
(apply [{ Helper.eraseInst(*${root}); }])
690655
>;
691656

692-
// Erase stores of poison values.
693-
def erase_poison_store
694-
: GICombineRule<(defs root:$root),
695-
(match(wip_match_opcode G_STORE):$root,
696-
[{ return Helper.matchPoisonStore(*${root}); }]),
697-
(apply [{ Helper.eraseInst(*${root}); }])>;
698-
699657
def simplify_add_to_sub_matchinfo: GIDefMatchData<"std::tuple<Register, Register>">;
700658
def simplify_add_to_sub: GICombineRule <
701659
(defs root:$root, simplify_add_to_sub_matchinfo:$info),
@@ -2023,11 +1981,6 @@ def undef_combines : GICombineGroup<[undef_to_fp_zero, undef_to_int_zero,
20231981
erase_undef_store,
20241982
insert_extract_vec_elt_out_of_bounds]>;
20251983

2026-
def poison_combines
2027-
: GICombineGroup<[binop_right_poison_to_poison, unary_poison_to_poison,
2028-
propagate_poison_any_op, propagate_poison_all_ops,
2029-
erase_poison_store]>;
2030-
20311984
def identity_combines : GICombineGroup<[select_same_val, right_identity_zero,
20321985
binop_same_val, binop_left_to_zero,
20331986
binop_right_to_zero, p2i_to_i2p,
@@ -2083,7 +2036,7 @@ def all_combines : GICombineGroup<[integer_reassoc_combines, trivial_combines,
20832036
vector_ops_combines, freeze_combines, cast_combines,
20842037
insert_vec_elt_combines, extract_vec_elt_combines, combines_for_extload,
20852038
combine_extracted_vector_load,
2086-
undef_combines, poison_combines, identity_combines, phi_combines,
2039+
undef_combines, identity_combines, phi_combines,
20872040
simplify_add_to_sub, hoist_logic_op_with_same_opcode_hands, shifts_too_big,
20882041
reassocs, ptr_add_immed_chain, cmp_combines,
20892042
shl_ashr_to_sext_inreg, neg_and_one_to_sext_inreg, sext_inreg_of_load,

llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ bool CombinerHelper::matchCombineConcatVectors(
330330
for (const MachineOperand &BuildVecMO : Def->uses())
331331
Ops.push_back(BuildVecMO.getReg());
332332
break;
333-
case TargetOpcode::G_POISON:
334333
case TargetOpcode::G_IMPLICIT_DEF: {
335334
LLT OpType = MRI.getType(Reg);
336335
// Keep one undef value for all the undef operands.
@@ -3128,7 +3127,6 @@ bool CombinerHelper::matchCombineInsertVecElts(
31283127
// If we didn't end in a G_IMPLICIT_DEF and the source is not fully
31293128
// overwritten, bail out.
31303129
return TmpInst->getOpcode() == TargetOpcode::G_IMPLICIT_DEF ||
3131-
TmpInst->getOpcode() == TargetOpcode::G_POISON ||
31323130
all_of(MatchInfo, [](Register Reg) { return !!Reg; });
31333131
}
31343132

@@ -3499,13 +3497,12 @@ bool CombinerHelper::matchUseVectorTruncate(MachineInstr &MI,
34993497
if (I < 2)
35003498
return false;
35013499

3502-
// Check the remaining source elements are only G_IMPLICIT_DEF or G_POISON
3500+
// Check the remaining source elements are only G_IMPLICIT_DEF
35033501
for (; I < NumOperands; ++I) {
35043502
auto SrcMI = MRI.getVRegDef(BuildMI->getSourceReg(I));
35053503
auto SrcMIOpc = SrcMI->getOpcode();
35063504

3507-
if (SrcMIOpc != TargetOpcode::G_IMPLICIT_DEF &&
3508-
SrcMIOpc != TargetOpcode::G_POISON)
3505+
if (SrcMIOpc != TargetOpcode::G_IMPLICIT_DEF)
35093506
return false;
35103507
}
35113508

@@ -7966,12 +7963,6 @@ bool CombinerHelper::matchShuffleDisjointMask(MachineInstr &MI,
79667963
if (getOpcodeDef(TargetOpcode::G_IMPLICIT_DEF, Shuffle.getSrc2Reg(), MRI))
79677964
return false;
79687965

7969-
if (getOpcodeDef(TargetOpcode::G_POISON, Shuffle.getSrc1Reg(), MRI))
7970-
return false;
7971-
7972-
if (getOpcodeDef(TargetOpcode::G_POISON, Shuffle.getSrc2Reg(), MRI))
7973-
return false;
7974-
79757966
const LLT DstTy = MRI.getType(Shuffle.getReg(0));
79767967
const LLT Src1Ty = MRI.getType(Shuffle.getSrc1Reg());
79777968
if (!isLegalOrBeforeLegalizer(

0 commit comments

Comments
 (0)