aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorThorsten Schütt <schuett@gmail.com>2024-03-26 18:44:34 +0100
committerGitHub <noreply@github.com>2024-03-26 18:44:34 +0100
commitda6cc4a24ff8953d51f7dc2c4974e8fc9089d693 (patch)
tree66861a3b32aa48152cbb7d8042394484cd818797 /llvm/lib/CodeGen/MachineInstr.cpp
parentd0e97fe38b91dac909e6a53ab16d306e5ef0b512 (diff)
downloadllvm-da6cc4a24ff8953d51f7dc2c4974e8fc9089d693.zip
llvm-da6cc4a24ff8953d51f7dc2c4974e8fc9089d693.tar.gz
llvm-da6cc4a24ff8953d51f7dc2c4974e8fc9089d693.tar.bz2
[CodeGen] Add nneg and disjoint flags (#86650)
MachineInstr learned the new flags.
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 8102bb9..717c81f 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -555,6 +555,17 @@ uint32_t MachineInstr::copyFlagsFromInstruction(const Instruction &I) {
MIFlags |= MachineInstr::MIFlag::NoUWrap;
}
+ // Copy the nonneg flag.
+ if (const PossiblyNonNegInst *PNI = dyn_cast<PossiblyNonNegInst>(&I)) {
+ if (PNI->hasNonNeg())
+ MIFlags |= MachineInstr::MIFlag::NonNeg;
+ // Copy the disjoint flag.
+ } else if (const PossiblyDisjointInst *PD =
+ dyn_cast<PossiblyDisjointInst>(&I)) {
+ if (PD->isDisjoint())
+ MIFlags |= MachineInstr::MIFlag::Disjoint;
+ }
+
// Copy the exact flag.
if (const PossiblyExactOperator *PE = dyn_cast<PossiblyExactOperator>(&I))
if (PE->isExact())
@@ -1706,6 +1717,10 @@ void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST,
OS << "nofpexcept ";
if (getFlag(MachineInstr::NoMerge))
OS << "nomerge ";
+ if (getFlag(MachineInstr::NonNeg))
+ OS << "nneg ";
+ if (getFlag(MachineInstr::Disjoint))
+ OS << "disjoint ";
// Print the opcode name.
if (TII)