[llvm] 9ae04a7 - [RISCV] Don't set nsw/nuw/exact flag after MachineCombiner reassociation.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 19 11:08:34 PST 2023
Author: Craig Topper
Date: 2023-11-19T11:08:28-08:00
New Revision: 9ae04a77d12667d1fe8a2392240a85bde9e490fc
URL: https://github.com/llvm/llvm-project/commit/9ae04a77d12667d1fe8a2392240a85bde9e490fc
DIFF: https://github.com/llvm/llvm-project/commit/9ae04a77d12667d1fe8a2392240a85bde9e490fc.diff
LOG: [RISCV] Don't set nsw/nuw/exact flag after MachineCombiner reassociation.
This matches what PowerPC and X86 do.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index 67658aa1dfb6b28..a8ec93c3d5069f0 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -1614,9 +1614,18 @@ void RISCVInstrInfo::setSpecialOperandAttr(MachineInstr &OldMI1,
MachineInstr &OldMI2,
MachineInstr &NewMI1,
MachineInstr &NewMI2) const {
+ // Propagate FP flags from the original instructions.
+ // But clear poison-generating flags because those may not be valid now.
uint32_t IntersectedFlags = OldMI1.getFlags() & OldMI2.getFlags();
NewMI1.setFlags(IntersectedFlags);
+ NewMI1.clearFlag(MachineInstr::MIFlag::NoSWrap);
+ NewMI1.clearFlag(MachineInstr::MIFlag::NoUWrap);
+ NewMI1.clearFlag(MachineInstr::MIFlag::IsExact);
+
NewMI2.setFlags(IntersectedFlags);
+ NewMI2.clearFlag(MachineInstr::MIFlag::NoSWrap);
+ NewMI2.clearFlag(MachineInstr::MIFlag::NoUWrap);
+ NewMI2.clearFlag(MachineInstr::MIFlag::IsExact);
}
void RISCVInstrInfo::finalizeInsInstrs(
More information about the llvm-commits
mailing list