use ArgOperand API; tighten type of handleFreeWithNonTrivialDependency to be able to use isFreeCall whithout a cast or new overload

llvm-svn: 106823
This commit is contained in:
Gabor Greif 2010-06-25 07:40:32 +00:00
parent 4d57fe4404
commit 07e9284c75
1 changed files with 7 additions and 5 deletions

View File

@ -56,7 +56,8 @@ namespace {
}
bool runOnBasicBlock(BasicBlock &BB);
bool handleFreeWithNonTrivialDependency(Instruction *F, MemDepResult Dep);
bool handleFreeWithNonTrivialDependency(const CallInst *F,
MemDepResult Dep);
bool handleEndBlock(BasicBlock &BB);
bool RemoveUndeadPointers(Value *Ptr, uint64_t killPointerSize,
BasicBlock::iterator &BBI,
@ -203,8 +204,8 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) {
if (InstDep.isNonLocal()) continue;
// Handle frees whose dependencies are non-trivial.
if (isFreeCall(Inst)) {
MadeChange |= handleFreeWithNonTrivialDependency(Inst, InstDep);
if (const CallInst *F = isFreeCall(Inst)) {
MadeChange |= handleFreeWithNonTrivialDependency(F, InstDep);
continue;
}
@ -289,7 +290,8 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) {
/// handleFreeWithNonTrivialDependency - Handle frees of entire structures whose
/// dependency is a store to a field of that structure.
bool DSE::handleFreeWithNonTrivialDependency(Instruction *F, MemDepResult Dep) {
bool DSE::handleFreeWithNonTrivialDependency(const CallInst *F,
MemDepResult Dep) {
AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
Instruction *Dependency = Dep.getInst();
@ -299,7 +301,7 @@ bool DSE::handleFreeWithNonTrivialDependency(Instruction *F, MemDepResult Dep) {
Value *DepPointer = getPointerOperand(Dependency)->getUnderlyingObject();
// Check for aliasing.
if (AA.alias(F->getOperand(1), 1, DepPointer, 1) !=
if (AA.alias(F->getArgOperand(0), 1, DepPointer, 1) !=
AliasAnalysis::MustAlias)
return false;