[llvm-commits] [llvm] r110077 - in /llvm/trunk: include/llvm/Analysis/Passes.h include/llvm/LinkAllPasses.h lib/Analysis/TypeBasedAliasAnalysis.cpp

Dan Gohman gohman at apple.com
Tue Aug 3 09:54:07 PDT 2010


On Aug 3, 2010, at 9:42 AM, Devang Patel wrote:
>> 
>> +AliasAnalysis::AliasResult
>> +TypeBasedAliasAnalysis::alias(const Value *A, unsigned ASize,
>> +                              const Value *B, unsigned BSize) {
>> +  // Currently, metadata can only be attached to Instructions.
>> +  const Instruction *AI = dyn_cast<Instruction>(A);
>> +  if (!AI) return MayAlias;
>> +  const Instruction *BI = dyn_cast<Instruction>(B);
>> +  if (!BI) return MayAlias;
> 
> What if two instructions are not from same function ?

Such queries are not valid, as has recently been discussed on this
list. I guess this code code be more aggressive about asserting for
that though.

>> +  // Get the attached MDNodes. If either value lacks a tbaa MDNode, we must
>> +  // be conservative.
>> +  MDNode *AM =
>> +    AI->getMetadata(AI->getParent()->getParent()->getParent()
>> +                      ->getMDKindID("tbaa"));
>> +  if (!AM) return MayAlias;
>> +  MDNode *BM =
>> +    AI->getMetadata(BI->getParent()->getParent()->getParent()
>> +                      ->getMDKindID("tbaa"));
> 
> typo here.  BI->getMetadata...

Fixed, thanks.

Dan





More information about the llvm-commits mailing list