summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-03-17 17:27:31 +0000
committerSanjay Patel <spatel@rotateright.com>2017-03-17 17:27:31 +0000
commit25bd713d33c6d0fa7b1e9248ed31dfb0dbdd5845 (patch)
treef30754728385e84054d6bb5f9bdcad012f26c2a5 /llvm/lib
parent98e56430b90c9c677eeefc1e2e6eb1953a7fdeb1 (diff)
downloadbcm5719-llvm-25bd713d33c6d0fa7b1e9248ed31dfb0dbdd5845.tar.gz
bcm5719-llvm-25bd713d33c6d0fa7b1e9248ed31dfb0dbdd5845.zip
[x86] avoid adc/sbb assert when both sides of add are zexted (PR32316)
As noted in the comment, we might want to account for this case, but I didn't look at what that would mean for the asm. I'm also not sure why this only reproduces with avx512, but I'm putting a conservative fix in for now to avoid the crash. Also, if both sides of an add are zexted, shouldn't we shrink that add? https://bugs.llvm.org/show_bug.cgi?id=32316 llvm-svn: 298107
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 63a69f54be2..a7e82493b1f 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -34266,12 +34266,16 @@ static SDValue combineAddOrSubToADCOrSBB(SDNode *N, SelectionDAG &DAG) {
std::swap(X, Y);
// Look through a one-use zext.
- if (Y.getOpcode() == ISD::ZERO_EXTEND && Y.hasOneUse())
+ bool PeekedThroughZext = false;
+ if (Y.getOpcode() == ISD::ZERO_EXTEND && Y.hasOneUse()) {
Y = Y.getOperand(0);
+ PeekedThroughZext = true;
+ }
// If this is an add, canonicalize a setcc operand to the RHS.
// TODO: Incomplete? What if both sides are setcc?
- if (!IsSub && X.getOpcode() == X86ISD::SETCC &&
+ // TODO: Should we allow peeking through a zext of the other operand?
+ if (!IsSub && !PeekedThroughZext && X.getOpcode() == X86ISD::SETCC &&
Y.getOpcode() != X86ISD::SETCC)
std::swap(X, Y);
OpenPOWER on IntegriCloud