[llvm] [Reassociate] Preserve NSW flags after expr tree rewriting (PR #93105)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed May 22 19:17:27 PDT 2024
================
@@ -648,6 +651,9 @@ 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) {
----------------
dtcxzyw wrote:
```suggestion
if (Opcode == Instruction::Add && Flags.AllKnownNonNegative && Flags.HasNSW) {
```
Can we avoid computing this when `HasNSW` is false?
https://github.com/llvm/llvm-project/pull/93105
More information about the llvm-commits
mailing list