[llvm] [Reassociate] Preserve NSW flags after expr tree rewriting (PR #93105)
Akshay Deodhar via llvm-commits
llvm-commits at lists.llvm.org
Sat May 25 11:47:07 PDT 2024
================
@@ -648,6 +651,13 @@ static bool LinearizeExprTree(Instruction *I,
// Ensure the leaf is only output once.
It->second = 0;
Ops.push_back(std::make_pair(V, Weight));
+ if (Opcode == Instruction::Add && Flags.AllKnownNonNegative &&
+ Flags.HasNSW) {
+ // Note: AllKnownNegative can be true in a case where one of the operands
+ // is negative, but one the operators is not NSW. AllKnownNegative should
+ // not be used independently of HasNSW
----------------
akshayrdeodhar wrote:
Makes sense, done.
https://github.com/llvm/llvm-project/pull/93105
More information about the llvm-commits
mailing list