Skip to content

Commit

Permalink
IR: Remove Value::intersectOptionalDataWith, replace all calls with c…
Browse files Browse the repository at this point in the history
…alls to Instruction::andIRFlags.

The two functions are functionally equivalent.

Differential Revision: https://reviews.llvm.org/D22830

llvm-svn: 280884
  • Loading branch information
pcc committed Sep 7, 2016
1 parent c5e53b2 commit 8f1dd5c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
5 changes: 0 additions & 5 deletions llvm/include/llvm/IR/Value.h
Expand Up @@ -442,11 +442,6 @@ class Value {
return SubclassOptionalData == V->SubclassOptionalData;
}

/// \brief Clear any optional flags not set in the given Value.
void intersectOptionalDataWith(const Value *V) {
SubclassOptionalData &= V->SubclassOptionalData;
}

/// \brief Return true if there is a value handle associated with this value.
bool hasValueHandle() const { return HasValueHandle; }

Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Scalar/GVNHoist.cpp
Expand Up @@ -696,7 +696,7 @@ class GVNHoist {
else
OtherGep = cast<GetElementPtrInst>(
cast<StoreInst>(OtherInst)->getPointerOperand());
ClonedGep->intersectOptionalDataWith(OtherGep);
ClonedGep->andIRFlags(OtherGep);
}

// Replace uses of Gep with ClonedGep in Repl.
Expand Down Expand Up @@ -843,7 +843,7 @@ class GVNHoist {
MSSA->removeMemoryAccess(OldMA);
}

Repl->intersectOptionalDataWith(I);
Repl->andIRFlags(I);
combineKnownMetadata(Repl, I);
I->replaceAllUsesWith(Repl);
// Also invalidate the Alias Analysis cache.
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp
Expand Up @@ -260,7 +260,7 @@ void MergedLoadStoreMotion::hoistInstruction(BasicBlock *BB,
assert(HoistCand->getParent() != BB);

// Intersect optional metadata.
HoistCand->intersectOptionalDataWith(ElseInst);
HoistCand->andIRFlags(ElseInst);
HoistCand->dropUnknownNonDebugMetadata();

// Prepend point for instruction insert
Expand Down Expand Up @@ -434,7 +434,7 @@ bool MergedLoadStoreMotion::sinkStore(BasicBlock *BB, StoreInst *S0,
// Hoist the instruction.
BasicBlock::iterator InsertPt = BB->getFirstInsertionPt();
// Intersect optional metadata.
S0->intersectOptionalDataWith(S1);
S0->andIRFlags(S1);
S0->dropUnknownNonDebugMetadata();

// Create the new store to be inserted at the join point.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Expand Up @@ -1230,7 +1230,7 @@ static bool HoistThenElseCodeToIf(BranchInst *BI,
BIParent->getInstList().splice(BI->getIterator(), BB1->getInstList(), I1);
if (!I2->use_empty())
I2->replaceAllUsesWith(I1);
I1->intersectOptionalDataWith(I2);
I1->andIRFlags(I2);
unsigned KnownIDs[] = {LLVMContext::MD_tbaa,
LLVMContext::MD_range,
LLVMContext::MD_fpmath,
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Vectorize/BBVectorize.cpp
Expand Up @@ -3148,7 +3148,7 @@ namespace {
LLVMContext::MD_noalias, LLVMContext::MD_fpmath,
LLVMContext::MD_invariant_group};
combineMetadata(K, H, KnownIDs);
K->intersectOptionalDataWith(H);
K->andIRFlags(H);

for (unsigned o = 0; o < NumOperands; ++o)
K->setOperand(o, ReplacedOperands[o]);
Expand Down

0 comments on commit 8f1dd5c

Please sign in to comment.