#include "llvm/Transforms/LevelChange.h"
#include "TransformInternals.h"
-#include "llvm/Function.h"
#include "llvm/iOther.h"
#include "llvm/iMemory.h"
-#include "llvm/Constants.h"
#include "llvm/Pass.h"
#include "llvm/ConstantHandling.h"
#include "llvm/Transforms/Scalar/DCE.h"
}
-
// Peephole optimize the following instructions:
// %t1 = cast ? to x *
// %t2 = add x * %SP, %t1 ;; Constant must be 2nd operand
return true;
}
- // Peephole optimize the following instructions:
- // %tmp = cast <ty> %V to <ty2>
- // %V = cast <ty2> %tmp to <ty3> ; Where ty & ty2 are same size
- //
- // Into: cast <ty> %V to <ty3>
- //
- if (SrcI)
- if (CastInst *CSrc = dyn_cast<CastInst>(SrcI))
- if (isReinterpretingCast(CI) + isReinterpretingCast(CSrc) < 2) {
- // We can only do c-c elimination if, at most, one cast does a
- // reinterpretation of the input data.
- //
- // If legal, make this cast refer the the original casts argument!
- //
- PRINT_PEEPHOLE2("cast-cast:in ", CI, CSrc);
- CI->setOperand(0, CSrc->getOperand(0));
- PRINT_PEEPHOLE1("cast-cast:out", CI);
- return true;
- }
-
// Check to see if it's a cast of an instruction that does not depend on the
// specific type of the operands to do it's job.
if (!isReinterpretingCast(CI)) {