[PATCH] D151473: [LegalizeTypes][AArch64][ARM] Teach PromoteIntegerResult to preserve NSW/NUW flags for ADD/SUB.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 11:01:21 PDT 2023


efriedma added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:1251
+    // Preserve nsw flag if the promoted inputs are sign extended.
+    if (N->getFlags().hasNoSignedWrap()) {
+      unsigned OpLEffectiveBits = DAG.ComputeMaxSignificantBits(LHS);
----------------
Do the flags on the original node actually matter here?  Unless I'm missing something, the logic you're using applies whether or not the original node was marked nsw/nuw.  (e.g. the sum of two zero-extended inputs is always nuw.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151473/new/

https://reviews.llvm.org/D151473



More information about the llvm-commits mailing list