[ARM] Allow bitcasts in ARMCodeGenPrepare
Allow bitcasts in the use-def chains, treating them as sources.
Differential Revision: https://reviews.llvm.org/D50758
llvm-svn: 342032
diff --git a/llvm/lib/Target/ARM/ARMCodeGenPrepare.cpp b/llvm/lib/Target/ARM/ARMCodeGenPrepare.cpp
index f7df39a..bc33e65 100644
--- a/llvm/lib/Target/ARM/ARMCodeGenPrepare.cpp
+++ b/llvm/lib/Target/ARM/ARMCodeGenPrepare.cpp
@@ -209,6 +209,8 @@
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);
return false;
@@ -545,11 +547,8 @@
isa<LoadInst>(V))
return isSupportedType(V);
- if (auto *Trunc = dyn_cast<TruncInst>(V))
- return isSupportedType(Trunc->getOperand(0));
-
- if (auto *ZExt = dyn_cast<ZExtInst>(V))
- return isSupportedType(ZExt->getOperand(0));
+ if (isa<CastInst>(V) && !isa<SExtInst>(V))
+ return isSupportedType(cast<CastInst>(V)->getOperand(0));
// Special cases for calls as we need to check for zeroext
// TODO We should accept calls even if they don't have zeroext, as they can