[LLVMdev] m_Not Pattern Question

Bill Wendling isanbard at gmail.com
Sun Nov 9 12:55:38 PST 2008

On Nov 9, 2008, at 7:51 AM, Nick Lewycky wrote:

> Bill Wendling wrote:
>> 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 ...
Ah! Okay. Thanks for the explanation.


More information about the llvm-dev mailing list