Index: include/llvm/IR/Value.h =================================================================== --- include/llvm/IR/Value.h +++ include/llvm/IR/Value.h @@ -442,11 +442,6 @@ 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; } Index: lib/Transforms/Scalar/GVNHoist.cpp =================================================================== --- lib/Transforms/Scalar/GVNHoist.cpp +++ lib/Transforms/Scalar/GVNHoist.cpp @@ -653,7 +653,7 @@ else OtherGep = cast( cast(OtherInst)->getPointerOperand()); - ClonedGep->intersectOptionalDataWith(OtherGep); + ClonedGep->andIRFlags(OtherGep); combineKnownMetadata(ClonedGep, OtherGep); } Repl->replaceUsesOfWith(Gep, ClonedGep); @@ -667,7 +667,7 @@ for (Instruction *OtherInst : InstructionsToHoist) { auto *OtherVal = cast(cast(OtherInst)->getValueOperand()); - ClonedVal->intersectOptionalDataWith(OtherVal); + ClonedVal->andIRFlags(OtherVal); combineKnownMetadata(ClonedVal, OtherVal); } Repl->replaceUsesOfWith(Val, ClonedVal); @@ -742,7 +742,7 @@ } else if (isa(Repl)) { ++NumCallsRemoved; } - Repl->intersectOptionalDataWith(I); + Repl->andIRFlags(I); combineKnownMetadata(Repl, I); I->replaceAllUsesWith(Repl); I->eraseFromParent(); Index: lib/Transforms/Scalar/MergedLoadStoreMotion.cpp =================================================================== --- lib/Transforms/Scalar/MergedLoadStoreMotion.cpp +++ lib/Transforms/Scalar/MergedLoadStoreMotion.cpp @@ -260,7 +260,7 @@ assert(HoistCand->getParent() != BB); // Intersect optional metadata. - HoistCand->intersectOptionalDataWith(ElseInst); + HoistCand->andIRFlags(ElseInst); HoistCand->dropUnknownNonDebugMetadata(); // Prepend point for instruction insert @@ -434,7 +434,7 @@ // 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. Index: lib/Transforms/Utils/SimplifyCFG.cpp =================================================================== --- lib/Transforms/Utils/SimplifyCFG.cpp +++ lib/Transforms/Utils/SimplifyCFG.cpp @@ -1215,7 +1215,7 @@ 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, @@ -1475,7 +1475,7 @@ if (!I2->use_empty()) I2->replaceAllUsesWith(I1); - I1->intersectOptionalDataWith(I2); + I1->andIRFlags(I2); // TODO: Use combineMetadata here to preserve what metadata we can // (analogous to the hoisting case above). I2->eraseFromParent(); Index: lib/Transforms/Vectorize/BBVectorize.cpp =================================================================== --- lib/Transforms/Vectorize/BBVectorize.cpp +++ lib/Transforms/Vectorize/BBVectorize.cpp @@ -3148,7 +3148,7 @@ 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]);