File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -503,6 +503,9 @@ class Instruction : public User,
503
503
// / Determine whether the the nneg flag is set.
504
504
bool hasNonNeg () const LLVM_READONLY;
505
505
506
+ constexpr static const unsigned PoisonGeneratingMetadataIDs[] = {
507
+ LLVMContext::MD_range, LLVMContext::MD_nonnull, LLVMContext::MD_align};
508
+
506
509
// / Return true if this operator has flags which may cause this instruction
507
510
// / to evaluate to poison despite having non-poison inputs.
508
511
bool hasPoisonGeneratingFlags () const LLVM_READONLY;
Original file line number Diff line number Diff line change @@ -458,9 +458,8 @@ void Instruction::dropPoisonGeneratingFlags() {
458
458
}
459
459
460
460
bool Instruction::hasPoisonGeneratingMetadata () const {
461
- return hasMetadata (LLVMContext::MD_range) ||
462
- hasMetadata (LLVMContext::MD_nonnull) ||
463
- hasMetadata (LLVMContext::MD_align);
461
+ return any_of (PoisonGeneratingMetadataIDs,
462
+ [this ](unsigned ID) { return hasMetadata (ID); });
464
463
}
465
464
466
465
bool Instruction::hasNonDebugLocLoopMetadata () const {
@@ -487,9 +486,8 @@ bool Instruction::hasNonDebugLocLoopMetadata() const {
487
486
}
488
487
489
488
void Instruction::dropPoisonGeneratingMetadata () {
490
- eraseMetadata (LLVMContext::MD_range);
491
- eraseMetadata (LLVMContext::MD_nonnull);
492
- eraseMetadata (LLVMContext::MD_align);
489
+ for (unsigned ID : PoisonGeneratingMetadataIDs)
490
+ eraseMetadata (ID);
493
491
}
494
492
495
493
bool Instruction::hasPoisonGeneratingReturnAttributes () const {
You can’t perform that action at this time.
0 commit comments