Skip to content

Commit 7da8126

Browse files
authored
Cleanup allocation and remat (rust-lang#916)
* Cleanup allocation and remat * fix
1 parent d5510e3 commit 7da8126

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

enzyme/Enzyme/GradientUtils.cpp

-19
Original file line numberDiff line numberDiff line change
@@ -7197,25 +7197,6 @@ void GradientUtils::computeForwardingProperties(Instruction *V) {
71977197
break;
71987198
case Intrinsic::memset: {
71997199
bool first = true;
7200-
#if LLVM_VERSION_MAJOR >= 14
7201-
for (auto &arg : II->args())
7202-
#else
7203-
for (auto &arg : II->arg_operands())
7204-
#endif
7205-
{
7206-
if (first) {
7207-
first = false;
7208-
break;
7209-
}
7210-
if (arg == prev) {
7211-
promotable = false;
7212-
shadowpromotable = false;
7213-
EmitWarning("NotPromotable", *cur, " Could not promote allocation ",
7214-
*V, " due to memset use ", *cur);
7215-
break;
7216-
}
7217-
break;
7218-
}
72197200
stores.insert(II);
72207201
storingOps.insert(II);
72217202
break;

enzyme/Enzyme/Utils.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ Function *getOrInsertExponentialAllocator(Module &M, Function *newFunc,
9999
IRBuilder<> B(BB);
100100
auto P = B.CreatePHI(i64, 1);
101101
CallInst *malloccall;
102-
CreateAllocation(B, RT, P, "tapemem", &malloccall, nullptr)->getType();
102+
Instruction *SubZero = nullptr;
103+
CreateAllocation(B, RT, P, "tapemem", &malloccall, &SubZero)->getType();
103104
if (auto F = getFunctionFromCall(malloccall)) {
104105
custom = F->getName() != "malloc";
105106
}

0 commit comments

Comments
 (0)