@@ -76,9 +76,8 @@ static llvm::cl::opt<bool> ClSanitizeGuardChecks(
7676RawAddress
7777CodeGenFunction::CreateTempAllocaWithoutCast (llvm::Type *Ty, CharUnits Align,
7878 const Twine &Name,
79- llvm::Value *ArraySize,
80- bool UseNondeterministicInit) {
81- auto Alloca = CreateTempAlloca (Ty, Name, ArraySize, UseNondeterministicInit);
79+ llvm::Value *ArraySize) {
80+ auto Alloca = CreateTempAlloca (Ty, Name, ArraySize);
8281 Alloca->setAlignment (Align.getAsAlign ());
8382 return RawAddress (Alloca, Ty, Align, KnownNonNull);
8483}
@@ -88,10 +87,8 @@ CodeGenFunction::CreateTempAllocaWithoutCast(llvm::Type *Ty, CharUnits Align,
8887RawAddress CodeGenFunction::CreateTempAlloca (llvm::Type *Ty, CharUnits Align,
8988 const Twine &Name,
9089 llvm::Value *ArraySize,
91- RawAddress *AllocaAddr,
92- bool UseNondeterministicInit) {
93- auto Alloca = CreateTempAllocaWithoutCast (Ty, Align, Name, ArraySize,
94- UseNondeterministicInit);
90+ RawAddress *AllocaAddr) {
91+ auto Alloca = CreateTempAllocaWithoutCast (Ty, Align, Name, ArraySize);
9592 if (AllocaAddr)
9693 *AllocaAddr = Alloca;
9794 llvm::Value *V = Alloca.getPointer ();
@@ -118,20 +115,22 @@ RawAddress CodeGenFunction::CreateTempAlloca(llvm::Type *Ty, CharUnits Align,
118115// / CreateTempAlloca - This creates an alloca and inserts it into the entry
119116// / block if \p ArraySize is nullptr, otherwise inserts it at the current
120117// / insertion point of the builder.
121- llvm::AllocaInst *
122- CodeGenFunction::CreateTempAlloca (llvm::Type *Ty, const Twine &Name,
123- llvm::Value *ArraySize,
124- bool UseNondeterministicInit) {
118+ llvm::AllocaInst *CodeGenFunction::CreateTempAlloca (llvm::Type *Ty,
119+ const Twine &Name,
120+ llvm::Value *ArraySize) {
121+ LLVM_DEBUG ( llvm::dbgs () << " DEBUG: " << Name << " \n " ;);
125122 llvm::AllocaInst *Alloca;
126123 if (ArraySize)
127124 Alloca = Builder.CreateAlloca (Ty, ArraySize, Name);
128125 else {
129126 Alloca = new llvm::AllocaInst (Ty, CGM.getDataLayout ().getAllocaAddrSpace (),
130127 ArraySize, Name, AllocaInsertPt);
131- if (UseNondeterministicInit) {
132- auto Freeze = new llvm::FreezeInst (llvm::PoisonValue::get (Ty),
133- " freeze.poison" , AllocaInsertPt);
134- new llvm::StoreInst (Freeze, Alloca, AllocaInsertPt);
128+ if (Ty->isIntegerTy ()) {
129+ llvm::IRBuilder<> StoreFreezePoisonBuilder (Alloca->getContext ());
130+ StoreFreezePoisonBuilder.SetInsertPoint (getPostAllocaInsertPoint ());
131+ auto FreezePoison = StoreFreezePoisonBuilder.CreateFreeze (
132+ llvm::PoisonValue::get (Ty), " freeze" );
133+ StoreFreezePoisonBuilder.CreateStore (FreezePoison, Alloca);
135134 }
136135 }
137136 if (Allocas) {
@@ -157,19 +156,16 @@ RawAddress CodeGenFunction::CreateIRTemp(QualType Ty, const Twine &Name) {
157156}
158157
159158RawAddress CodeGenFunction::CreateMemTemp (QualType Ty, const Twine &Name,
160- RawAddress *Alloca,
161- bool UseNondeterministicInit) {
159+ RawAddress *Alloca) {
162160 // FIXME: Should we prefer the preferred type alignment here?
163- return CreateMemTemp (Ty, getContext ().getTypeAlignInChars (Ty), Name, Alloca,
164- UseNondeterministicInit);
161+ return CreateMemTemp (Ty, getContext ().getTypeAlignInChars (Ty), Name, Alloca);
165162}
166163
167164RawAddress CodeGenFunction::CreateMemTemp (QualType Ty, CharUnits Align,
168- const Twine &Name, RawAddress *Alloca,
169- bool UseNondeterministicInit) {
170- RawAddress Result =
171- CreateTempAlloca (ConvertTypeForMem (Ty), Align, Name,
172- /* ArraySize=*/ nullptr , Alloca, UseNondeterministicInit);
165+ const Twine &Name,
166+ RawAddress *Alloca) {
167+ RawAddress Result = CreateTempAlloca (ConvertTypeForMem (Ty), Align, Name,
168+ /* ArraySize=*/ nullptr , Alloca);
173169
174170 if (Ty->isConstantMatrixType ()) {
175171 auto *ArrayTy = cast<llvm::ArrayType>(Result.getElementType ());
0 commit comments