[llvm] [Reassociate] Preserve NSW flags after expr tree rewriting (PR #93105)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri May 24 23:56:49 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
----------------
nikic wrote:
This comment should probably be on the member in the struct declaration?
https://github.com/llvm/llvm-project/pull/93105
More information about the llvm-commits
mailing list