File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
include/llvm/Transforms/Utils Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -565,6 +565,12 @@ struct OverflowTracking {
565
565
bool HasNSW = true ;
566
566
bool IsDisjoint = true ;
567
567
568
+ #ifndef NDEBUG
569
+ // / Opcode of merged instructions. All instructions passed to mergeFlags must
570
+ // / have the same opcode.
571
+ std::optional<unsigned > Opcode;
572
+ #endif
573
+
568
574
// Note: At the moment, users are responsible to manage AllKnownNonNegative
569
575
// and AllKnownNonZero manually. AllKnownNonNegative can be true in a case
570
576
// where one of the operands is negative, but one the operators is not NSW.
Original file line number Diff line number Diff line change @@ -4364,6 +4364,13 @@ bool llvm::inferAttributesFromOthers(Function &F) {
4364
4364
}
4365
4365
4366
4366
void OverflowTracking::mergeFlags (Instruction &I) {
4367
+ #ifndef NDEBUG
4368
+ if (Opcode)
4369
+ assert (Opcode == I.getOpcode () &&
4370
+ " can only use mergeFlags on instructions with matching opcodes" );
4371
+ else
4372
+ Opcode = I.getOpcode ();
4373
+ #endif
4367
4374
if (isa<OverflowingBinaryOperator>(&I)) {
4368
4375
HasNUW &= I.hasNoUnsignedWrap ();
4369
4376
HasNSW &= I.hasNoSignedWrap ();
You can’t perform that action at this time.
0 commit comments