From a7b42034fcd0814572547637fc808587ae0822da Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 24 Feb 2009 19:10:46 +0000 Subject: [PATCH] Extension of GEP in constant folder was broken (apparently this code has never been run!). - Sorry, don't know how to make an LLVM test case for this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65383 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/ConstantFold.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index ff4d897e54a..f2847112afc 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -1664,7 +1664,7 @@ Constant *llvm::ConstantFoldGetElementPtr(const Constant *C, Offset = ConstantExpr::getSExt(Offset, Base->getType()); else if (Base->getType()->getPrimitiveSizeInBits() < Offset->getType()->getPrimitiveSizeInBits()) - Base = ConstantExpr::getZExt(Base, Base->getType()); + Base = ConstantExpr::getZExt(Base, Offset->getType()); Base = ConstantExpr::getAdd(Base, Offset); return ConstantExpr::getIntToPtr(Base, CE->getType()); -- 2.11.0