From bdda0ce16544f503f06a627c3db0579d876a7e04 Mon Sep 17 00:00:00 2001 From: William Moses Date: Sat, 28 Dec 2024 21:12:20 -0500 Subject: [PATCH] Fix batched shadow reverse runtime AA (#2210) --- enzyme/Enzyme/DiffeGradientUtils.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/enzyme/Enzyme/DiffeGradientUtils.cpp b/enzyme/Enzyme/DiffeGradientUtils.cpp index eba0de11f54..e88e762e7f0 100644 --- a/enzyme/Enzyme/DiffeGradientUtils.cpp +++ b/enzyme/Enzyme/DiffeGradientUtils.cpp @@ -1179,9 +1179,13 @@ void DiffeGradientUtils::addToInvertedPtrDiffe( // the pointers and conditionally execute. if ((!isa(basePtr) && !isAllocationCall(basePtr, TLI)) && runtimeActivity && !merge) { - Value *shadow = Builder2.CreateICmpNE( - lookupM(getNewFromOriginal(origptr), Builder2), - lookupM(invertPointerM(origptr, Builder2), Builder2)); + Value *primal_val = lookupM(getNewFromOriginal(origptr), Builder2); + Value *shadow_val = + lookupM(invertPointerM(origptr, Builder2), Builder2); + if (getWidth() != 1) { + shadow_val = extractMeta(Builder2, shadow_val, 0); + } + Value *shadow = Builder2.CreateICmpNE(primal_val, shadow_val); BasicBlock *current = Builder2.GetInsertBlock(); BasicBlock *conditional =