Displaying 2 results from an estimated 2 matches for "m_foo".
Did you mean:
_foo
2008 Nov 09
0
[LLVMdev] m_Not Pattern Question
...CV;
> return true;
> }
> return false;
> }
> };
>
> Why are we taking a reference to a pointer here? The assignment in the
> "match" method over writes the value of "B", which seems weird and
> wrong to me.
This is deliberate. m_Foo(V) means "match any Foo and put its result
into V." The way it's generally used is to declare empty variables,
match against them, and test the equality:
Value *A, *B, *C, *D;
if (match(Expr, m_Or(m_And(A, B), m_And(C, D))) {
if (B == D) {
... do optimization ......
2008 Nov 09
2
[LLVMdev] m_Not Pattern Question
I have a question about the pattern matching stuff that's used in the
Instruction Combiner. If I have code like this:
if (match(B, m_Select(m_Value(), m_ConstantInt(0),
m_ConstantInt(-1)))) {
if (match(C, m_Not(m_Value(B))))
return SelectInst::Create(cast<User>(B)->getOperand(0), D, A);
and we match, the program fails during the