From 184773d81febbf1428aa98498beef844ce0d142f Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 17 Feb 2017 19:43:45 +0000 Subject: WholeProgramDevirt: For VCP use a 32-bit ConstantInt for the byte offset. A future change will cause this byte offset to be inttoptr'd and then exported via an absolute symbol. On the importing end we will expect the symbol to be in range [0,2^32) so that it will fit into a 32-bit relocation. The problem is that on 64-bit architectures if the offset is negative it will not be in the correct range once we inttoptr it. This change causes us to use a 32-bit integer so that it can be inttoptr'd (which zero extends) into the correct range. Differential Revision: https://reviews.llvm.org/D30016 llvm-svn: 295487 --- llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp') diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp index a9baa8d6bb7..7470d46c1c0 100644 --- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp +++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp @@ -838,7 +838,7 @@ bool DevirtModule::tryVirtualConstProp( Target.WasDevirt = true; // Rewrite each call to a load from OffsetByte/OffsetBit. - Constant *ByteConst = ConstantInt::get(Int64Ty, OffsetByte); + Constant *ByteConst = ConstantInt::get(Int32Ty, OffsetByte); Constant *BitConst = ConstantInt::get(Int8Ty, 1ULL << OffsetBit); applyVirtualConstProp(CSByConstantArg.second, TargetsForSlot[0].Fn->getName(), ByteConst, BitConst); -- cgit v1.2.3