[llvm] [LICM] Make an integer version of hoistFPAssociation. (PR #67736)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 12 08:00:19 PST 2024
================
@@ -2661,21 +2670,31 @@ static bool hoistAddSub(Instruction &I, Loop &L, ICFLoopSafetyInfo &SafetyInfo,
return false;
}
+static BinaryOperator *isReassociableOp(BinaryOperator *BO, unsigned Opcode1,
+ unsigned Opcode2) {
+ if (BO->getOpcode() == Opcode1 || BO->getOpcode() == Opcode2)
+ if (!isa<FPMathOperator>(BO) ||
+ (BO->hasAllowReassoc() && BO->hasNoSignedZeros()))
+ return BO;
+ return nullptr;
+}
+
----------------
paulwalker-arm wrote:
It is worth making the int and fp opcodes explicit to simplify the function like:
```
if (BO->getOpcode() == IntOpode)
return BO;
if (BO->getOpcode() == FpOpcode && BO->hasAllowReassoc() && BO->hasNoSignedZeros())
return B0;
return nullptr;
```
https://github.com/llvm/llvm-project/pull/67736
More information about the llvm-commits
mailing list