llvm.org GIT mirror llvm / bf9f9da
Merge 98203 from mainline. fix PR6533 by updating the br(xor) code to remember the case when it looked past a trunc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_27@98306 91177308-0d34-0410-b5e6-96231b3b80d8 Tanya Lattner 10 years ago
2 changed file(s) with 22 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
46044604
46054605 SDNode *Trunc = 0;
46064606 if (N1.getOpcode() == ISD::TRUNCATE && N1.hasOneUse()) {
4607 // Look pass truncate.
4607 // Look past truncate.
46084608 Trunc = N1.getNode();
46094609 N1 = N1.getOperand(0);
46104610 }
46994699 Equal = true;
47004700 }
47014701
4702 EVT SetCCVT = N1.getValueType();
4702 SDValue NodeToReplace = Trunc ? SDValue(Trunc, 0) : N1;
4703
4704 EVT SetCCVT = NodeToReplace.getValueType();
47034705 if (LegalTypes)
47044706 SetCCVT = TLI.getSetCCResultType(SetCCVT);
47054707 SDValue SetCC = DAG.getSetCC(TheXor->getDebugLoc(),
47084710 Equal ? ISD::SETEQ : ISD::SETNE);
47094711 // Replace the uses of XOR with SETCC
47104712 WorkListRemover DeadNodes(*this);
4711 DAG.ReplaceAllUsesOfValueWith(N1, SetCC, &DeadNodes);
4712 removeFromWorkList(N1.getNode());
4713 DAG.DeleteNode(N1.getNode());
4713 DAG.ReplaceAllUsesOfValueWith(NodeToReplace, SetCC, &DeadNodes);
4714 removeFromWorkList(NodeToReplace.getNode());
4715 DAG.DeleteNode(NodeToReplace.getNode());
47144716 return DAG.getNode(ISD::BRCOND, N->getDebugLoc(),
47154717 MVT::Other, Chain, SetCC, N2);
47164718 }
1717 volatile store i32 %conv19.i, i32* undef
1818 ret i32 undef
1919 }
20
21 ; PR6533
22 define void @test2(i1 %x, i32 %y) nounwind {
23 %land.ext = zext i1 %x to i32 ; [#uses=1]
24 %and = and i32 %y, 1 ; [#uses=1]
25 %xor = xor i32 %and, %land.ext ; [#uses=1]
26 %cmp = icmp eq i32 %xor, 1 ; [#uses=1]
27 br i1 %cmp, label %if.end, label %if.then
28
29 if.then: ; preds = %land.end
30 ret void
31
32 if.end: ; preds = %land.end
33 ret void
34 }