mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 23:31:37 +00:00
Add some debugging output
Fix InstCombine/2004-03-13-InstCombineInfLoop.ll which caused an infinite loop compiling (I think) povray. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12365 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ffd072af91
commit
0cea42a560
@ -33,6 +33,7 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#define DEBUG_TYPE "instcombine"
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/Intrinsics.h"
|
#include "llvm/Intrinsics.h"
|
||||||
@ -46,6 +47,7 @@
|
|||||||
#include "llvm/Support/InstIterator.h"
|
#include "llvm/Support/InstIterator.h"
|
||||||
#include "llvm/Support/InstVisitor.h"
|
#include "llvm/Support/InstVisitor.h"
|
||||||
#include "llvm/Support/CallSite.h"
|
#include "llvm/Support/CallSite.h"
|
||||||
|
#include "Support/Debug.h"
|
||||||
#include "Support/Statistic.h"
|
#include "Support/Statistic.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -1551,7 +1553,7 @@ Instruction *InstCombiner::visitSetCondInst(BinaryOperator &I) {
|
|||||||
if (CastInst *CI = dyn_cast<CastInst>(Op0)) {
|
if (CastInst *CI = dyn_cast<CastInst>(Op0)) {
|
||||||
Value *CastOp0 = CI->getOperand(0);
|
Value *CastOp0 = CI->getOperand(0);
|
||||||
if (CastOp0->getType()->isLosslesslyConvertibleTo(CI->getType()) &&
|
if (CastOp0->getType()->isLosslesslyConvertibleTo(CI->getType()) &&
|
||||||
!isa<Argument>(Op1) &&
|
(isa<Constant>(Op1) || isa<CastInst>(Op1)) &&
|
||||||
(I.getOpcode() == Instruction::SetEQ ||
|
(I.getOpcode() == Instruction::SetEQ ||
|
||||||
I.getOpcode() == Instruction::SetNE)) {
|
I.getOpcode() == Instruction::SetNE)) {
|
||||||
// We keep moving the cast from the left operand over to the right
|
// We keep moving the cast from the left operand over to the right
|
||||||
@ -2543,6 +2545,9 @@ bool InstCombiner::runOnFunction(Function &F) {
|
|||||||
++NumCombined;
|
++NumCombined;
|
||||||
// Should we replace the old instruction with a new one?
|
// Should we replace the old instruction with a new one?
|
||||||
if (Result != I) {
|
if (Result != I) {
|
||||||
|
DEBUG(std::cerr << "IC: Old = " << *I
|
||||||
|
<< " New = " << *Result);
|
||||||
|
|
||||||
// Instructions can end up on the worklist more than once. Make sure
|
// Instructions can end up on the worklist more than once. Make sure
|
||||||
// we do not process an instruction that has been deleted.
|
// we do not process an instruction that has been deleted.
|
||||||
removeFromWorkList(I);
|
removeFromWorkList(I);
|
||||||
@ -2561,6 +2566,8 @@ bool InstCombiner::runOnFunction(Function &F) {
|
|||||||
// Erase the old instruction.
|
// Erase the old instruction.
|
||||||
InstParent->getInstList().erase(I);
|
InstParent->getInstList().erase(I);
|
||||||
} else {
|
} else {
|
||||||
|
DEBUG(std::cerr << "IC: MOD = " << *I);
|
||||||
|
|
||||||
BasicBlock::iterator II = I;
|
BasicBlock::iterator II = I;
|
||||||
|
|
||||||
// If the instruction was modified, it's possible that it is now dead.
|
// If the instruction was modified, it's possible that it is now dead.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user