Skip to content

Commit 35cbf2d

Browse files
committed
DAG: Handle poison in m_Undef
1 parent 930066f commit 35cbf2d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

llvm/include/llvm/CodeGen/SDPatternMatch.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,9 @@ template <typename... Preds> auto m_NoneOf(const Preds &...preds) {
222222

223223
inline Opcode_match m_Opc(unsigned Opcode) { return Opcode_match(Opcode); }
224224

225-
inline Opcode_match m_Undef() { return Opcode_match(ISD::UNDEF); }
225+
template <typename... Preds> auto m_Undef() {
226+
return m_AnyOf(Opcode_match(ISD::UNDEF), Opcode_match(ISD::POISON));
227+
}
226228

227229
inline Opcode_match m_Poison() { return Opcode_match(ISD::POISON); }
228230

llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,8 @@ TEST_F(SelectionDAGPatternMatchTest, matchConstants) {
551551
SDValue PoisonVInt32VT = DAG->getPOISON(VInt32VT);
552552
EXPECT_TRUE(sd_match(PoisonInt32VT, m_Poison()));
553553
EXPECT_TRUE(sd_match(PoisonVInt32VT, m_Poison()));
554+
EXPECT_TRUE(sd_match(PoisonInt32VT, m_Undef()));
555+
EXPECT_TRUE(sd_match(PoisonVInt32VT, m_Undef()));
554556
}
555557

556558
TEST_F(SelectionDAGPatternMatchTest, patternCombinators) {

0 commit comments

Comments
 (0)