mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Fix this xform: (sra (shl X, m), result_size) -> (sign_extend (trunc (shl X, result_size - n - m)))
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48578 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2400,7 +2400,9 @@ SDOperand DAGCombiner::visitSRA(SDNode *N) {
|
||||
|
||||
// If the shift wouldn't be a noop, the truncated type is an actual type,
|
||||
// and the truncate is free, then proceed with the transform.
|
||||
if (ShiftAmt != 0 && TLI.isTruncateFree(VT, TruncVT)) {
|
||||
if (ShiftAmt != 0 &&
|
||||
TLI.isTypeLegal(TruncVT) &&
|
||||
TLI.isTruncateFree(VT, TruncVT)) {
|
||||
SDOperand Amt = DAG.getConstant(ShiftAmt, TLI.getShiftAmountTy());
|
||||
SDOperand Shift = DAG.getNode(ISD::SRL, VT, N0.getOperand(0), Amt);
|
||||
SDOperand Trunc = DAG.getNode(ISD::TRUNCATE, TruncVT, Shift);
|
||||
|
Reference in New Issue
Block a user