Skip to content

Commit dddf6c6

Browse files
authored
Fix renaming of getModRefBehavior to getMemoryEffects (rust-lang#936)
1 parent 1b5f1f1 commit dddf6c6

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

enzyme/Enzyme/ActivityAnalysis.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1766,7 +1766,7 @@ bool ActivityAnalyzer::isConstantValue(TypeResults const &TR, Value *Val) {
17661766
if (!memval->getType()->isPointerTy()) {
17671767
if (auto CB = dyn_cast<CallInst>(I)) {
17681768
#if LLVM_VERSION_MAJOR >= 16
1769-
AARes = AA.getModRefBehavior(CB).getModRef();
1769+
AARes = AA.getMemoryEffects(CB).getModRef();
17701770
#else
17711771
AARes = createModRefInfo(AA.getModRefBehavior(CB));
17721772
#endif

enzyme/Enzyme/MLIR/Dialect/EnzymeOps.td

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def ActivityArrayAttr : TypedArrayAttrBase<
3636
ActivityAttr, "Array of argument activity states">;
3737

3838
def PlaceholderOp : Enzyme_Op<"placeholder",
39-
[NoSideEffect]> {
39+
[Pure]> {
4040
let results = (outs AnyType:$output);
4141
}
4242

enzyme/Enzyme/MLIR/Interfaces/GradientUtils.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ void mlir::enzyme::MGradientUtils::forceAugmentedReturns() {
216216
// getContext(cast<BasicBlock>(getNewFromOriginal(&oBB)), loopContext);
217217

218218
oldFunc.walk([&](Block *blk) {
219-
if (blk == &oldFunc.getBody().getBlocks().front())
219+
if (blk == &oldFunc.getFunctionBody().getBlocks().front())
220220
return;
221221
auto nblk = getNewFromOriginal(blk);
222222
for (auto val : llvm::reverse(blk->getArguments())) {
@@ -510,15 +510,15 @@ FunctionOpInterface CloneFunctionWithReturns(
510510
DIFFE_TYPE returnType, Twine name, BlockAndValueMapping &VMap,
511511
std::map<Operation *, Operation *> &OpMap, bool diffeReturnArg,
512512
mlir::Type additionalArg) {
513-
assert(!F.getBody().empty());
513+
assert(!F.getFunctionBody().empty());
514514
// F = preprocessForClone(F, mode);
515515
// llvm::ValueToValueMapTy VMap;
516516
auto FTy = getFunctionTypeForClone(
517517
F.getFunctionType().cast<mlir::FunctionType>(), mode, width,
518518
additionalArg, constant_args, diffeReturnArg, returnValue, returnType);
519519

520520
/*
521-
for (Block &BB : F.getBody().getBlocks()) {
521+
for (Block &BB : F.getFunctionBody().getBlocks()) {
522522
if (auto ri = dyn_cast<ReturnInst>(BB.getTerminator())) {
523523
if (auto rv = ri->getReturnValue()) {
524524
returnvals.insert(rv);
@@ -538,12 +538,12 @@ FunctionOpInterface CloneFunctionWithReturns(
538538
table.insert(NewF);
539539
SymbolTable::setSymbolVisibility(NewF, SymbolTable::Visibility::Private);
540540

541-
cloneInto(&F.getBody(), &NewF.getBody(), VMap, OpMap);
541+
cloneInto(&F.getFunctionBody(), &NewF.getFunctionBody(), VMap, OpMap);
542542

543543
{
544-
auto &blk = NewF.getBody().front();
544+
auto &blk = NewF.getFunctionBody().front();
545545
for (ssize_t i = constant_args.size() - 1; i >= 0; i--) {
546-
mlir::Value oval = F.getBody().front().getArgument(i);
546+
mlir::Value oval = F.getFunctionBody().front().getArgument(i);
547547
if (constant_args[i] == DIFFE_TYPE::CONSTANT)
548548
constants.insert(oval);
549549
else
@@ -771,7 +771,7 @@ FunctionOpInterface mlir::enzyme::MEnzymeLogic::CreateForwardDiff(
771771
std::vector<DIFFE_TYPE> constants, MTypeAnalysis &TA, bool returnUsed,
772772
DerivativeMode mode, bool freeMemory, size_t width, mlir::Type addedType,
773773
MFnTypeInfo type_args, std::vector<bool> volatile_args, void *augmented) {
774-
if (fn.getBody().empty()) {
774+
if (fn.getFunctionBody().empty()) {
775775
llvm::errs() << fn << "\n";
776776
llvm_unreachable("Differentiating empty function");
777777
}
@@ -829,7 +829,7 @@ FunctionOpInterface mlir::enzyme::MEnzymeLogic::CreateForwardDiff(
829829
unnecessaryInstructions, gutils, TLI);
830830
*/
831831

832-
for (Block &oBB : gutils->oldFunc.getBody().getBlocks()) {
832+
for (Block &oBB : gutils->oldFunc.getFunctionBody().getBlocks()) {
833833
// Don't create derivatives for code that results in termination
834834
if (guaranteedUnreachable.find(&oBB) != guaranteedUnreachable.end()) {
835835
auto newBB = gutils->getNewFromOriginal(&oBB);
@@ -865,7 +865,7 @@ FunctionOpInterface mlir::enzyme::MEnzymeLogic::CreateForwardDiff(
865865

866866
// gutils->eraseFictiousPHIs();
867867

868-
mlir::Block *entry = &gutils->newFunc.getBody().front();
868+
mlir::Block *entry = &gutils->newFunc.getFunctionBody().front();
869869

870870
// cleanupInversionAllocs(gutils, entry);
871871
// clearFunctionAttributes(gutils->newFunc);

enzyme/Enzyme/MLIR/Passes/EnzymeMLIRPass.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct DifferentiatePass : public DifferentiatePassBase<DifferentiatePass> {
7373
size_t width = 1;
7474

7575
std::vector<bool> volatile_args;
76-
for (auto &a : fn.getBody().getArguments()) {
76+
for (auto &a : fn.getFunctionBody().getArguments()) {
7777
volatile_args.push_back(!(mode == DerivativeMode::ReverseModeCombined));
7878
}
7979

0 commit comments

Comments
 (0)