From e8bda8b5d5ff2f6a3418fc8e8ebda02461ee105c Mon Sep 17 00:00:00 2001 From: "William S. Moses" Date: Mon, 18 Sep 2023 01:44:22 -0400 Subject: [PATCH] Special case gep of small_typeof --- enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp b/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp index bbf63b9a4c90..2a6c1426aa97 100644 --- a/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp +++ b/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp @@ -1401,6 +1401,16 @@ void TypeAnalyzer::visitGetElementPtrInst(GetElementPtrInst &gep) { return; } } + if (auto GV = dyn_cast(gep.getPointerOperand())) { + // from julia code, do not propagate int to operands + if (GV->getName() == "small_typeof") { + TypeTree T; + T.insert({-1}, BaseType::Pointer); + T.insert({-1, -1}, BaseType::Pointer); + updateAnalysis(&gep, T, &gep); + return; + } + } if (gep.indices().begin() == gep.indices().end()) { if (direction & DOWN)