1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[DAG] x | x --> x

llvm-svn: 285522
This commit is contained in:
Sanjay Patel 2016-10-30 18:19:35 +00:00
parent afee2949d3
commit 96bc59eeab
2 changed files with 4 additions and 2 deletions

View File

@ -3815,6 +3815,10 @@ SDValue DAGCombiner::visitOR(SDNode *N) {
SDValue N1 = N->getOperand(1);
EVT VT = N1.getValueType();
// x | x --> x
if (N0 == N1)
return N0;
// fold vector ops
if (VT.isVector()) {
if (SDValue FoldedVOp = SimplifyVBinOp(N))

View File

@ -4,7 +4,6 @@
define i32 @or_self(i32 %x) {
; CHECK-LABEL: or_self:
; CHECK: # BB#0:
; CHECK-NEXT: orl %edi, %edi
; CHECK-NEXT: movl %edi, %eax
; CHECK-NEXT: retq
%or = or i32 %x, %x
@ -14,7 +13,6 @@ define i32 @or_self(i32 %x) {
define <4 x i32> @or_self_vec(<4 x i32> %x) {
; CHECK-LABEL: or_self_vec:
; CHECK: # BB#0:
; CHECK-NEXT: orps %xmm0, %xmm0
; CHECK-NEXT: retq
%or = or <4 x i32> %x, %x
ret <4 x i32> %or