mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 07:24:25 +00:00
teach the truncation optimization that an entire chain of
computation can be truncated if it is fed by a sext/zext that doesn't have to be exactly equal to the truncation result type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112285 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -396,6 +396,11 @@ static bool CanEvaluateTruncated(Value *V, const Type *Ty) {
|
||||
case Instruction::Trunc:
|
||||
// trunc(trunc(x)) -> trunc(x)
|
||||
return true;
|
||||
case Instruction::ZExt:
|
||||
case Instruction::SExt:
|
||||
// trunc(ext(x)) -> ext(x) if the source type is smaller than the new dest
|
||||
// trunc(ext(x)) -> trunc(x) if the source type is larger than the new dest
|
||||
return true;
|
||||
case Instruction::Select: {
|
||||
SelectInst *SI = cast<SelectInst>(I);
|
||||
return CanEvaluateTruncated(SI->getTrueValue(), Ty) &&
|
||||
|
Reference in New Issue
Block a user