mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 06:29:05 +00:00
just remove this xform which is subsumed by others.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92775 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -681,31 +681,6 @@ Instruction *InstCombiner::visitTrunc(TruncInst &CI) {
|
|||||||
return BinaryOperator::CreateShl(V1, V2);
|
return BinaryOperator::CreateShl(V1, V2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are discarding information from a simple binop, rewrite.
|
|
||||||
if (Src->hasOneUse() && isa<Instruction>(Src)) {
|
|
||||||
Instruction *SrcI = cast<Instruction>(Src);
|
|
||||||
switch (SrcI->getOpcode()) {
|
|
||||||
default: break;
|
|
||||||
case Instruction::Add:
|
|
||||||
// TODO: SUB?
|
|
||||||
case Instruction::Mul:
|
|
||||||
case Instruction::And:
|
|
||||||
case Instruction::Or:
|
|
||||||
case Instruction::Xor:
|
|
||||||
Value *Op0 = SrcI->getOperand(0);
|
|
||||||
Value *Op1 = SrcI->getOperand(1);
|
|
||||||
|
|
||||||
// Don't insert two casts unless at least one can be eliminated.
|
|
||||||
if (!ValueRequiresCast(Instruction::Trunc, Op1, DestTy) ||
|
|
||||||
!ValueRequiresCast(Instruction::Trunc, Op0, DestTy)) {
|
|
||||||
Op0 = Builder->CreateTrunc(Op0, DestTy, Op0->getName());
|
|
||||||
Op1 = Builder->CreateTrunc(Op1, DestTy, Op1->getName());
|
|
||||||
return BinaryOperator::Create(cast<BinaryOperator>(SrcI)->getOpcode(),
|
|
||||||
Op0, Op1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -223,8 +223,8 @@ define i32 @test23(i8* %P, i64 %A){
|
|||||||
%G = sub i32 %D, %F
|
%G = sub i32 %D, %F
|
||||||
ret i32 %G
|
ret i32 %G
|
||||||
; CHECK: @test23
|
; CHECK: @test23
|
||||||
; CHECK: %A1 = trunc i64 %A to i32
|
; CHECK-NEXT: = trunc i64 %A to i32
|
||||||
; CHECK: ret i32 %A1
|
; CHECK-NEXT: ret i32
|
||||||
}
|
}
|
||||||
|
|
||||||
define i64 @test24(i8* %P, i64 %A){
|
define i64 @test24(i8* %P, i64 %A){
|
||||||
|
Reference in New Issue
Block a user