[llvm] [Reassociate] Preserve NSW flags after expr tree rewriting (PR #93105)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 00:17:38 PDT 2024


================
@@ -648,6 +651,10 @@ 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) {
----------------
dtcxzyw wrote:

Drop braces here.
See https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

https://github.com/llvm/llvm-project/pull/93105


More information about the llvm-commits mailing list