Question about addr capture
Shuxin Yang
shuxin.llvm at gmail.com
Fri Mar 22 14:22:28 PDT 2013
On 3/22/13 1:45 PM, Duncan Sands wrote:
> 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.
I guess we could the use this way to reconstruct the ptr value at
assembly level, because
the compare is sort of sub on many architectures.
However, at IR level, the LHS of icmp only has one bit, it is not able
reconstruct
the ptr value without the original value. But, equal-comp could be a
different story,
the result of "p == q" can be used to reconstruct p from q.
>
> 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 you sharing this info. I will try.
It would be nice to have a complete picture of what the original authors
were concerning about.
I have a defect at hand which entails flow-sensitive address-capture
analysis. I'd like to
implement such analysis to replace current address capture analysis, in
the mean time to get rid
of the some "hacks" which try to achieve certain degree of
flow-sensitivity.
>>
>> 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
>
> _______________________________________________
> 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