[PATCH] [X86] Fix a bug with fetch_add(INT32_MIN)
JF Bastien
jfb at chromium.org
Tue Oct 7 16:14:58 PDT 2014
================
Comment at: lib/Target/X86/X86ISelDAGToDAG.cpp:1717
@@ +1716,3 @@
+ // Quit if INT32_MIN: it would be negated as it is negative and overflow,
+ // producing an immediate too big to be merged into the sub.
+ if (CNVal == std::numeric_limits<int32_t>::min())
----------------
The key thing to understand is that negating `INT32_MIN` makes it not fit in 32-bits. I'm not sure the comment makes that clear.
================
Comment at: lib/Target/X86/X86ISelDAGToDAG.cpp:1718
@@ +1717,3 @@
+ // producing an immediate too big to be merged into the sub.
+ if (CNVal == std::numeric_limits<int32_t>::min())
+ return CurDAG->getTargetConstant(CNVal, NVT);
----------------
It looks like the prevalent thing is to use `INT32_MIN` from `<stdint.h>` instead of `std::numeric_limits`. I know I pointed you at `std::numeric_limits`, but I think we should follow what other parts of LLVM use.
http://reviews.llvm.org/D5655
More information about the llvm-commits
mailing list