[PATCH] [X86] Fix a bug with fetch_add(INT32_MIN)
Robin Morisset
morisset at google.com
Tue Oct 7 15:03:50 PDT 2014
Hi jfb,
Fix pr21099
The pseudocode of what we were doing (spread through two functions) was:
if (operand.doesNotFitIn32Bits())
Opc.initializeWithFoo();
if (operand < 0)
operand = -operand;
if (operand.doesFitIn8Bits())
Opc.initializeWithBar();
else if (operand.doesFitIn32Bits())
Opc.initializeWithBlah();
doStuff(Opc);
So for operand == INT32_MIN, Opc was never initialized because the operand changes
from fitting in 32 bits to not fitting, causing the various bugs/error messages
noted by pr21099.
This patch adds an extra test at the beginning for this case, and an
llvm_unreachable to have better error message if the operand ends up
not fitting in 32-bits at the end.
http://reviews.llvm.org/D5655
Files:
lib/Target/X86/X86ISelDAGToDAG.cpp
test/CodeGen/X86/pr21099.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5655.14531.patch
Type: text/x-patch
Size: 1640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141007/8d31e756/attachment.bin>
More information about the llvm-commits
mailing list