Skip to content

Commit 3824a2d

Browse files
committed
[MemoryBuiltins] Support allocas in getInitialValueOfAllocation (NFC)
1 parent b2bf017 commit 3824a2d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

llvm/lib/Analysis/MemoryBuiltins.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,9 @@ llvm::getAllocSize(const CallBase *CB, const TargetLibraryInfo *TLI,
428428
Constant *llvm::getInitialValueOfAllocation(const Value *V,
429429
const TargetLibraryInfo *TLI,
430430
Type *Ty) {
431+
if (isa<AllocaInst>(V))
432+
return UndefValue::get(Ty);
433+
431434
auto *Alloc = dyn_cast<CallBase>(V);
432435
if (!Alloc)
433436
return nullptr;

llvm/lib/Transforms/IPO/Attributor.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,6 @@ Constant *
242242
AA::getInitialValueForObj(Attributor &A, const AbstractAttribute &QueryingAA,
243243
Value &Obj, Type &Ty, const TargetLibraryInfo *TLI,
244244
const DataLayout &DL, AA::RangeTy *RangePtr) {
245-
if (isa<AllocaInst>(Obj))
246-
return UndefValue::get(&Ty);
247245
if (Constant *Init = getInitialValueOfAllocation(&Obj, TLI, &Ty))
248246
return Init;
249247
auto *GV = dyn_cast<GlobalVariable>(&Obj);

0 commit comments

Comments
 (0)