[llvm] [GISel][CombinerHelper] Push freeze through non-poison-producing operands (PR #90618)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue May 7 13:18:25 PDT 2024
================
@@ -36,79 +36,19 @@ class GenericMachineInstr : public MachineInstr {
}
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;
- }
+ return getFlag(NoUWrap) || getFlag(NoSWrap) || getFlag(IsExact) ||
+ getFlag(Disjoint) || getFlag(NonNeg) || getFlag(FmNoNans) ||
+ getFlag(FmNoInfs);
----------------
arsenm wrote:
can also just do this in one bit test on getFlags
https://github.com/llvm/llvm-project/pull/90618
More information about the llvm-commits
mailing list