Skip to content

Commit 5325724

Browse files
authored
Fix weird allocation (#1918)
1 parent 46647d1 commit 5325724

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

enzyme/Enzyme/Utils.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@ Value *CreateAllocation(IRBuilder<> &Builder, llvm::Type *T, Value *Count,
301301
res = unwrap(CustomAllocator(wrap(&Builder), wrap(T), wrap(Count),
302302
wrap(Align), isDefault,
303303
ZeroMem ? &wzeromem : nullptr));
304+
if (isa<UndefValue>(res))
305+
return res;
306+
if (isa<Constant>(res))
307+
return res;
304308
if (auto I = dyn_cast<Instruction>(res))
305309
I->setName(Name);
306310

0 commit comments

Comments
 (0)