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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113144 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-09-06 03:58:04 +00:00
parent 902edf2166
commit 09981982f1

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