Skip to content

Commit 3a49ca3

Browse files
committed
Update CodeGen to use hasMetadata as appropriate [NFC]
My intial grepping for rL370933 missed a directory worth of cases. llvm-svn: 370942
1 parent f6233d9 commit 3a49ca3

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

llvm/lib/CodeGen/SelectionDAG/FastISel.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ bool FastISel::lowerCallTo(CallLoweringInfo &CLI) {
12371237
updateValueMap(CLI.CS->getInstruction(), CLI.ResultReg, CLI.NumResultRegs);
12381238

12391239
// Set labels for heapallocsite call.
1240-
if (CLI.CS && CLI.CS->getInstruction()->getMetadata("heapallocsite")) {
1240+
if (CLI.CS && CLI.CS->getInstruction()->hasMetadata("heapallocsite")) {
12411241
const MDNode *MD = CLI.CS->getInstruction()->getMetadata("heapallocsite");
12421242
MF->addCodeViewHeapAllocSite(CLI.Call, MD);
12431243
}
@@ -2417,10 +2417,9 @@ FastISel::createMachineMemOperandFor(const Instruction *I) const {
24172417
} else
24182418
return nullptr;
24192419

2420-
bool IsNonTemporal = I->getMetadata(LLVMContext::MD_nontemporal) != nullptr;
2421-
bool IsInvariant = I->getMetadata(LLVMContext::MD_invariant_load) != nullptr;
2422-
bool IsDereferenceable =
2423-
I->getMetadata(LLVMContext::MD_dereferenceable) != nullptr;
2420+
bool IsNonTemporal = I->hasMetadata(LLVMContext::MD_nontemporal);
2421+
bool IsInvariant = I->hasMetadata(LLVMContext::MD_invariant_load);
2422+
bool IsDereferenceable = I->hasMetadata(LLVMContext::MD_dereferenceable);
24242423
const MDNode *Ranges = I->getMetadata(LLVMContext::MD_range);
24252424

24262425
AAMDNodes AAInfo;

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2262,7 +2262,7 @@ void SelectionDAGBuilder::visitBr(const BranchInst &I) {
22622262
if (const BinaryOperator *BOp = dyn_cast<BinaryOperator>(CondVal)) {
22632263
Instruction::BinaryOps Opcode = BOp->getOpcode();
22642264
if (!DAG.getTargetLoweringInfo().isJumpExpensive() && BOp->hasOneUse() &&
2265-
!I.getMetadata(LLVMContext::MD_unpredictable) &&
2265+
!I.hasMetadata(LLVMContext::MD_unpredictable) &&
22662266
(Opcode == Instruction::And || Opcode == Instruction::Or)) {
22672267
FindMergedConditions(BOp, Succ0MBB, Succ1MBB, BrMBB, BrMBB,
22682268
Opcode,
@@ -4002,8 +4002,8 @@ void SelectionDAGBuilder::visitLoad(const LoadInst &I) {
40024002
Type *Ty = I.getType();
40034003

40044004
bool isVolatile = I.isVolatile();
4005-
bool isNonTemporal = I.getMetadata(LLVMContext::MD_nontemporal) != nullptr;
4006-
bool isInvariant = I.getMetadata(LLVMContext::MD_invariant_load) != nullptr;
4005+
bool isNonTemporal = I.hasMetadata(LLVMContext::MD_nontemporal);
4006+
bool isInvariant = I.hasMetadata(LLVMContext::MD_invariant_load);
40074007
bool isDereferenceable =
40084008
isDereferenceablePointer(SV, I.getType(), DAG.getDataLayout());
40094009
unsigned Alignment = I.getAlignment();
@@ -4132,8 +4132,8 @@ void SelectionDAGBuilder::visitLoadFromSwiftError(const LoadInst &I) {
41324132
"call visitLoadFromSwiftError when backend supports swifterror");
41334133

41344134
assert(!I.isVolatile() &&
4135-
I.getMetadata(LLVMContext::MD_nontemporal) == nullptr &&
4136-
I.getMetadata(LLVMContext::MD_invariant_load) == nullptr &&
4135+
!I.hasMetadata(LLVMContext::MD_nontemporal) &&
4136+
!I.hasMetadata(LLVMContext::MD_invariant_load) &&
41374137
"Support volatile, non temporal, invariant for load_from_swift_error");
41384138

41394139
const Value *SV = I.getOperand(0);
@@ -4209,7 +4209,7 @@ void SelectionDAGBuilder::visitStore(const StoreInst &I) {
42094209
auto MMOFlags = MachineMemOperand::MONone;
42104210
if (I.isVolatile())
42114211
MMOFlags |= MachineMemOperand::MOVolatile;
4212-
if (I.getMetadata(LLVMContext::MD_nontemporal) != nullptr)
4212+
if (I.hasMetadata(LLVMContext::MD_nontemporal))
42134213
MMOFlags |= MachineMemOperand::MONonTemporal;
42144214
MMOFlags |= TLI.getMMOFlags(I);
42154215

@@ -4641,7 +4641,7 @@ void SelectionDAGBuilder::visitAtomicLoad(const LoadInst &I) {
46414641
auto Flags = MachineMemOperand::MOLoad;
46424642
if (I.isVolatile())
46434643
Flags |= MachineMemOperand::MOVolatile;
4644-
if (I.getMetadata(LLVMContext::MD_invariant_load) != nullptr)
4644+
if (I.hasMetadata(LLVMContext::MD_invariant_load))
46454645
Flags |= MachineMemOperand::MOInvariant;
46464646
if (isDereferenceablePointer(I.getPointerOperand(), I.getType(),
46474647
DAG.getDataLayout()))

0 commit comments

Comments
 (0)