[llvm] [GISel][CombinerHelper] Push freeze through non-poison-producing operands (PR #90618)
Dhruv Chawla via llvm-commits
llvm-commits at lists.llvm.org
Tue May 7 02:42:23 PDT 2024
================
@@ -34,6 +34,83 @@ class GenericMachineInstr : public MachineInstr {
static bool classof(const MachineInstr *MI) {
return isPreISelGenericOpcode(MI->getOpcode());
}
+
+ bool hasPoisonGeneratingFlags() const {
+ switch (getOpcode()) {
+ case TargetOpcode::G_ADD:
+ case TargetOpcode::G_SUB:
+ case TargetOpcode::G_MUL:
+ case TargetOpcode::G_SHL:
+ case TargetOpcode::G_TRUNC:
+ return getFlag(NoUWrap) || getFlag(NoSWrap);
+
+ case TargetOpcode::G_UDIV:
+ case TargetOpcode::G_SDIV:
+ case TargetOpcode::G_ASHR:
+ case TargetOpcode::G_LSHR:
+ return getFlag(IsExact);
+
+ case TargetOpcode::G_OR:
+ return getFlag(Disjoint);
+
+ case TargetOpcode::G_UITOFP:
+ case TargetOpcode::G_ZEXT:
+ return getFlag(NonNeg);
+
+ case TargetOpcode::G_FNEG:
+ case TargetOpcode::G_FADD:
+ case TargetOpcode::G_FSUB:
+ case TargetOpcode::G_FMUL:
+ case TargetOpcode::G_FDIV:
+ case TargetOpcode::G_FREM:
+ case TargetOpcode::G_FCMP:
+ return getFlag(FmNoNans) || getFlag(FmNoInfs);
+
+ default:
+ return false;
+ }
+ }
+
+ void dropPoisonGeneratingFlags() {
+ switch (getOpcode()) {
----------------
dc03-work wrote:
Addressed.
https://github.com/llvm/llvm-project/pull/90618
More information about the llvm-commits
mailing list