cleanup some of the lifetime/invariant marker stuff, add a big fixme.

llvm-svn: 113144
This commit is contained in:
Chris Lattner 2010-09-06 03:58:04 +00:00
parent 96fe532c67
commit a58edd1df3
1 changed files with 11 additions and 6 deletions

View File

@ -175,7 +175,7 @@ getPointerDependencyFrom(Value *MemPtr, uint64_t MemSize, bool isLoad,
} }
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) { if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) {
// Debug intrinsics don't cause dependences. // Debug intrinsics don't (and can't) cause dependences.
if (isa<DbgInfoIntrinsic>(II)) continue; if (isa<DbgInfoIntrinsic>(II)) continue;
// If we pass an invariant-end marker, then we've just entered an // If we pass an invariant-end marker, then we've just entered an
@ -185,25 +185,30 @@ getPointerDependencyFrom(Value *MemPtr, uint64_t MemSize, bool isLoad,
// pointer, not on query pointers that are indexed off of them. It'd // pointer, not on query pointers that are indexed off of them. It'd
// be nice to handle that at some point. // be nice to handle that at some point.
AliasAnalysis::AliasResult R = AA->alias(II->getArgOperand(2), MemPtr); AliasAnalysis::AliasResult R = AA->alias(II->getArgOperand(2), MemPtr);
if (R == AliasAnalysis::MustAlias) { if (R == AliasAnalysis::MustAlias)
InvariantTag = II->getArgOperand(0); InvariantTag = II->getArgOperand(0);
continue;
} continue;
}
// If we reach a lifetime begin or end marker, then the query ends here // If we reach a lifetime begin or end marker, then the query ends here
// because the value is undefined. // because the value is undefined.
} else if (II->getIntrinsicID() == Intrinsic::lifetime_start) { if (II->getIntrinsicID() == Intrinsic::lifetime_start) {
// FIXME: This only considers queries directly on the invariant-tagged // FIXME: This only considers queries directly on the invariant-tagged
// pointer, not on query pointers that are indexed off of them. It'd // pointer, not on query pointers that are indexed off of them. It'd
// be nice to handle that at some point. // be nice to handle that at some point.
AliasAnalysis::AliasResult R = AA->alias(II->getArgOperand(1), MemPtr); AliasAnalysis::AliasResult R = AA->alias(II->getArgOperand(1), MemPtr);
if (R == AliasAnalysis::MustAlias) if (R == AliasAnalysis::MustAlias)
return MemDepResult::getDef(II); return MemDepResult::getDef(II);
continue;
} }
} }
// If we're querying on a load and we're in an invariant region, we're done // If we're querying on a load and we're in an invariant region, we're done
// at this point. Nothing a load depends on can live in an invariant region. // at this point. Nothing a load depends on can live in an invariant region.
//
// FIXME: this will prevent us from returning load/load must-aliases, so GVN
// won't remove redundant loads.
if (isLoad && InvariantTag) continue; if (isLoad && InvariantTag) continue;
// Values depend on loads if the pointers are must aliased. This means that // Values depend on loads if the pointers are must aliased. This means that