File tree 2 files changed +16
-10
lines changed
2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -9923,16 +9923,23 @@ SDValue DAGCombiner::visitSRL(SDNode *N) {
9923
9923
// However when after the source operand of SRL is optimized into AND, the SRL
9924
9924
// itself may not be optimized further. Look for it and add the BRCOND into
9925
9925
// the worklist.
9926
+ //
9927
+ // The also tends to happen for binary operations when SimplifyDemandedBits
9928
+ // is involved.
9929
+ //
9930
+ // FIXME: This is unecessary if we process the DAG in topological order,
9931
+ // which we plan to do. This workaround can be removed once the DAG is
9932
+ // processed in topological order.
9926
9933
if (N->hasOneUse()) {
9927
9934
SDNode *Use = *N->use_begin();
9928
- if (Use->getOpcode() == ISD::BRCOND)
9929
- AddToWorklist(Use);
9930
- else if (Use->getOpcode() == ISD::TRUNCATE && Use->hasOneUse()) {
9931
- // Also look pass the truncate.
9935
+
9936
+ // Look pass the truncate.
9937
+ if (Use->getOpcode() == ISD::TRUNCATE && Use->hasOneUse())
9932
9938
Use = *Use->use_begin();
9933
- if (Use->getOpcode() == ISD::BRCOND)
9934
- AddToWorklist(Use);
9935
- }
9939
+
9940
+ if (Use->getOpcode() == ISD::BRCOND || Use->getOpcode() == ISD::AND ||
9941
+ Use->getOpcode() == ISD::OR || Use->getOpcode() == ISD::XOR)
9942
+ AddToWorklist(Use);
9936
9943
}
9937
9944
9938
9945
// Try to transform this shift into a multiply-high if
Original file line number Diff line number Diff line change @@ -262,10 +262,9 @@ define i8 @low_bit_select_constants_bigger_true_narrower_result(i16 %x) {
262
262
define i1 @opaque_constant (i48 %x , i48 %y ) {
263
263
; X64-LABEL: opaque_constant:
264
264
; X64: # %bb.0:
265
- ; X64-NEXT: movq %rsi , %rax
266
- ; X64-NEXT: shrq $32 , %rdi
265
+ ; X64-NEXT: movq %rdi , %rax
266
+ ; X64-NEXT: xorq %rsi , %rax
267
267
; X64-NEXT: shrq $32, %rax
268
- ; X64-NEXT: xorl %edi, %eax
269
268
; X64-NEXT: andl $1, %eax
270
269
; X64-NEXT: # kill: def $al killed $al killed $rax
271
270
; X64-NEXT: retq
You can’t perform that action at this time.
0 commit comments