|
41 | 41 | #include "llvm/IR/MatrixBuilder.h" |
42 | 42 | #include "llvm/Passes/OptimizationLevel.h" |
43 | 43 | #include "llvm/Support/ConvertUTF.h" |
| 44 | +#include "llvm/Support/Debug.h" |
44 | 45 | #include "llvm/Support/MathExtras.h" |
45 | 46 | #include "llvm/Support/Path.h" |
46 | 47 | #include "llvm/Support/SaveAndRestore.h" |
|
50 | 51 | #include <optional> |
51 | 52 | #include <string> |
52 | 53 |
|
| 54 | +#define DEBUG_TYPE "CGExpr" |
| 55 | + |
53 | 56 | using namespace clang; |
54 | 57 | using namespace CodeGen; |
55 | 58 |
|
@@ -115,12 +118,21 @@ RawAddress CodeGenFunction::CreateTempAlloca(llvm::Type *Ty, CharUnits Align, |
115 | 118 | llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty, |
116 | 119 | const Twine &Name, |
117 | 120 | llvm::Value *ArraySize) { |
| 121 | + LLVM_DEBUG(llvm::dbgs() << "DEBUG: " << Name << "\n";); |
118 | 122 | llvm::AllocaInst *Alloca; |
119 | 123 | if (ArraySize) |
120 | 124 | Alloca = Builder.CreateAlloca(Ty, ArraySize, Name); |
121 | | - else |
| 125 | + else { |
122 | 126 | Alloca = new llvm::AllocaInst(Ty, CGM.getDataLayout().getAllocaAddrSpace(), |
123 | 127 | ArraySize, Name, 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); |
| 134 | + } |
| 135 | + } |
124 | 136 | if (Allocas) { |
125 | 137 | Allocas->Add(Alloca); |
126 | 138 | } |
|
0 commit comments