diff options
-rw-r--r-- | llvm/lib/Target/ARM/ARMCodeGenPrepare.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMCodeGenPrepare.cpp b/llvm/lib/Target/ARM/ARMCodeGenPrepare.cpp index 2403b9e1327..0a6ea9dc325 100644 --- a/llvm/lib/Target/ARM/ARMCodeGenPrepare.cpp +++ b/llvm/lib/Target/ARM/ARMCodeGenPrepare.cpp @@ -633,8 +633,9 @@ void IRPromoter::TruncateSinks(SmallPtrSetImpl<Value*> &Sources, LLVM_DEBUG(dbgs() << "ARM CGP: Creating " << *TruncTy << " Trunc for " << *V << "\n"); Builder.SetInsertPoint(cast<Instruction>(V)); - auto *Trunc = cast<Instruction>(Builder.CreateTrunc(V, TruncTy)); - NewInsts.insert(Trunc); + auto *Trunc = dyn_cast<Instruction>(Builder.CreateTrunc(V, TruncTy)); + if (Trunc) + NewInsts.insert(Trunc); return Trunc; }; |