[PATCH] D159406: [SelectionDAG] Generalise SelectionDAG::computeOverflowKind to support other opcodes

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 4 08:01:19 PDT 2023


RKSimon added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4058
+  unsigned BitWidth = N0.getScalarValueSizeInBits();
+  // Sum of the leading zeros.
+  unsigned SignBits = ComputeNumSignBits(N0) + ComputeNumSignBits(N1);
----------------
leading zeros -> sign bits.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4060
+  unsigned SignBits = ComputeNumSignBits(N0) + ComputeNumSignBits(N1);
+  // If we have enough leading zeros, then there's no overflow.
+  if (SignBits > BitWidth + 1)
----------------
leading zeros -> sign bits.


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

https://reviews.llvm.org/D159406



More information about the llvm-commits mailing list