Question about addr capture

Duncan Sands baldrick at free.fr
Fri Mar 22 13:45:46 PDT 2013


Hi Shuxin,

On 22/03/13 18:56, Shuxin Yang wrote:
> Hi, list:
>
>       Would someone shed some light on the following code.  How can an address
> be captured via icmp?

using icmp you can determine each bit of the value, one by one, and then
reconstruct the value from those bits.

Ciao, Duncan.

PS: I think there are some fairly comprehensive test cases for capture tracking,
and they are commented IIRC.  If you disable some logic, like this, you should
see a test case fail.  Hopefully it should then become clear from the test case
what the issue is.

>
> Thanks
> Shuxin
>
> cat -n lib/Analysis/CaptureTracking.cpp
> ==========================
> 157     case Instruction::ICmp:
> 158       // Don't count comparisons of a no-alias return value against null as
> 159       // captures. This allows us to ignore comparisons of malloc results
> 160       // with null, for example.
> 161       if (isNoAliasCall(V->stripPointerCasts()))
> 162         if (ConstantPointerNull *CPN =
> 163 dyn_cast<ConstantPointerNull>(I->getOperand(1)))
> 164           if (CPN->getType()->getAddressSpace() == 0)
> 165             break;
> 166       // Otherwise, be conservative. There are crazy ways to capture pointers
> 167       // using comparisons.
> 168       if (Tracker->captured(U))
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list