From: Davide Italiano Date: Fri, 1 Sep 2017 19:36:34 +0000 (+0000) Subject: [TTI] Initialize a value to trigger a crash deterministically. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7902ceb44348cd8cc281da31e5e4148e5744887e;p=llvm [TTI] Initialize a value to trigger a crash deterministically. We expect the pointer to be initialized by the above loop, but if that's not executed, the contents are garbage. A fix for the crash will be committed immediately after. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312353 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/TargetTransformInfoImpl.h b/include/llvm/Analysis/TargetTransformInfoImpl.h index 24989941ac8..c191b86b494 100644 --- a/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -674,7 +674,7 @@ public: int64_t Scale = 0; auto GTI = gep_type_begin(PointeeType, Operands); - Type *TargetType; + Type *TargetType = nullptr; for (auto I = Operands.begin(); I != Operands.end(); ++I, ++GTI) { TargetType = GTI.getIndexedType(); // We assume that the cost of Scalar GEP with constant index and the