[PATCH] D144565: dwp check overflow

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 10:53:22 PST 2023


ayermolo added inline comments.


================
Comment at: llvm/lib/MC/MCTargetOptionsCommandFlags.cpp:90
 
+  static cl::opt<bool> WarnOverflow(
+      "warn-overflow", cl::desc("Warn about section overflow in dwp and "
----------------
I don't see a reason why this should be MC layer option. Can you move it to llvm-dwp?


================
Comment at: llvm/test/tools/llvm-dwp/X86/overflow-warning.test:4
+RUN: llvm-dwp -e hello.o -e main.o -warn-overflow -o overflow.dwp 2>&1 | FileCheck %s
+CHECK: warning: Section size overflow in debug_info.dwo
----------------
Can you check that overflow behavior is preserved?


================
Comment at: llvm/tools/llvm-dwp/llvm-dwp.cpp:470
       bool Overflow = false;
       APInt NewOffset = Offset.uadd_ov(NewLength, Overflow);
       if (Overflow) {
----------------
I think this will break the overflow behavior that llvm patch I references relies on.


```
APInt APInt::uadd_sat(const APInt &RHS) const {
  bool Overflow;
  APInt Res = uadd_ov(RHS, Overflow);
  if (!Overflow)
    return Res;
 
  return APInt::getMaxValue(BitWidth);
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144565



More information about the llvm-commits mailing list