[llvm-branch-commits] [llvm-branch] r322670 - Merging r321991:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jan 17 07:50:27 PST 2018
Author: hans
Date: Wed Jan 17 07:50:27 2018
New Revision: 322670
URL: http://llvm.org/viewvc/llvm-project?rev=322670&view=rev
Log:
Merging r321991:
------------------------------------------------------------------------
r321991 | sam_parker | 2018-01-08 05:21:24 -0800 (Mon, 08 Jan 2018) | 9 lines
[DAGCombine] Fix for PR35761
I had falsely assumed that constant operands would be operand(1) of
the bin ops that may need their constant operand to be masked.
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=35761
Differential Revision: https://reviews.llvm.org/D41667
------------------------------------------------------------------------
Added:
llvm/branches/release_60/test/CodeGen/X86/pr35761.ll
- copied unchanged from r321991, llvm/trunk/test/CodeGen/X86/pr35761.ll
Modified:
llvm/branches/release_60/ (props changed)
llvm/branches/release_60/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Propchange: llvm/branches/release_60/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jan 17 07:50:27 2018
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,321789,321980,321993,322056,322103,322623
+/llvm/trunk:155241,321789,321980,321991,321993,322056,322103,322623
Modified: llvm/branches/release_60/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_60/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=322670&r1=322669&r2=322670&view=diff
==============================================================================
--- llvm/branches/release_60/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/branches/release_60/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Jan 17 07:50:27 2018
@@ -3914,10 +3914,16 @@ bool DAGCombiner::BackwardsPropagateMask
// Narrow any constants that need it.
for (auto *LogicN : NodesWithConsts) {
- auto *C = cast<ConstantSDNode>(LogicN->getOperand(1));
- SDValue And = DAG.getNode(ISD::AND, SDLoc(C), C->getValueType(0),
- SDValue(C, 0), MaskOp);
- DAG.UpdateNodeOperands(LogicN, LogicN->getOperand(0), And);
+ SDValue Op0 = LogicN->getOperand(0);
+ SDValue Op1 = LogicN->getOperand(1);
+
+ if (isa<ConstantSDNode>(Op0))
+ std::swap(Op0, Op1);
+
+ SDValue And = DAG.getNode(ISD::AND, SDLoc(Op1), Op1.getValueType(),
+ Op1, MaskOp);
+
+ DAG.UpdateNodeOperands(LogicN, Op0, And);
}
// Create narrow loads.
More information about the llvm-branch-commits
mailing list