[LLVMdev] matching function call arguments

Hari Pyla harip at vt.edu
Mon Mar 7 05:08:40 PST 2011


Hi,
 I am trying to identify if two functions were called with exactly the same argument. For instance, in the below example, assuming both entry() and exit() functions take a single argument, I would like to know if arg1 in entry() is same as arg1in exit().

int a;
struct sa
{
  int b;
  int c;
};

int main ()
{
   struct sa s;
  
   entry (arg1);
    ...
   exit (arg1);
    
   return 0;
}

In instances such as entry(a) and exit (a). I am able to determine that it is the same variable 'a' using '==' on the callinst->getOperand(1)'. However, if I pass a member variable of a structure say (s.b) to both entry and exit, I am unable to use '==' since the operands are GEP instructions. How can I compare such arguments to check if they are identical and also I was wondering as to what is best approach to determine if these arguments are exactly identical. Thanks in advance.

Best,
--Hari





More information about the llvm-dev mailing list