aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TypePromotion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/TypePromotion.cpp')
-rw-r--r--llvm/lib/CodeGen/TypePromotion.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/TypePromotion.cpp b/llvm/lib/CodeGen/TypePromotion.cpp
index e6c0b3242d67..426292345a14 100644
--- a/llvm/lib/CodeGen/TypePromotion.cpp
+++ b/llvm/lib/CodeGen/TypePromotion.cpp
@@ -235,8 +235,6 @@ bool TypePromotionImpl::isSource(Value *V) {
return true;
else if (isa<LoadInst>(V))
return true;
- else if (isa<BitCastInst>(V))
- return true;
else if (auto *Call = dyn_cast<CallInst>(V))
return Call->hasRetAttr(Attribute::AttrKind::ZExt);
else if (auto *Trunc = dyn_cast<TruncInst>(V))
@@ -724,8 +722,9 @@ bool TypePromotionImpl::isSupportedValue(Value *V) {
case Instruction::Ret:
case Instruction::Load:
case Instruction::Trunc:
- case Instruction::BitCast:
return isSupportedType(I);
+ case Instruction::BitCast:
+ return I->getOperand(0)->getType() == I->getType();
case Instruction::ZExt:
return isSupportedType(I->getOperand(0));
case Instruction::ICmp:
@@ -960,8 +959,8 @@ bool TypePromotionImpl::run(Function &F, const TargetMachine *TM,
if (isa<ZExtInst>(&I) && isa<PHINode>(I.getOperand(0)) &&
isa<IntegerType>(I.getType()) && BBIsInLoop(&BB)) {
- LLVM_DEBUG(dbgs() << "IR Promotion: Searching from: " << I.getOperand(0)
- << "\n");
+ LLVM_DEBUG(dbgs() << "IR Promotion: Searching from: "
+ << *I.getOperand(0) << "\n");
EVT ZExtVT = TLI->getValueType(DL, I.getType());
Instruction *Phi = static_cast<Instruction *>(I.getOperand(0));
auto PromoteWidth = ZExtVT.getFixedSizeInBits();