mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
Fix using wrong result type for setcc.
When reducing the bitwidth of a comparison against a constant, the original setcc's result type was used, which was incorrect. No test since I don't think any other in tree targets change the bitwidth of the setcc type depending on the bitwidth of the compared type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208236 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1382,10 +1382,14 @@ TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
|
||||
EVT newVT = N0.getOperand(0).getValueType();
|
||||
if (DCI.isBeforeLegalizeOps() ||
|
||||
(isOperationLegal(ISD::SETCC, newVT) &&
|
||||
getCondCodeAction(Cond, newVT.getSimpleVT())==Legal))
|
||||
return DAG.getSetCC(dl, VT, N0.getOperand(0),
|
||||
DAG.getConstant(C1.trunc(InSize), newVT),
|
||||
Cond);
|
||||
getCondCodeAction(Cond, newVT.getSimpleVT()) == Legal)) {
|
||||
EVT NewSetCCVT = getSetCCResultType(*DAG.getContext(), newVT);
|
||||
SDValue NewConst = DAG.getConstant(C1.trunc(InSize), newVT);
|
||||
|
||||
SDValue NewSetCC = DAG.getSetCC(dl, NewSetCCVT, N0.getOperand(0),
|
||||
NewConst, Cond);
|
||||
return DAG.getBoolExtOrTrunc(NewSetCC, dl, VT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
Reference in New Issue
Block a user