projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[opaque pointer type]: Pass explicit pointee type when building a constant GEP.
[oota-llvm.git]
/
lib
/
Transforms
/
Utils
/
ValueMapper.cpp
diff --git
a/lib/Transforms/Utils/ValueMapper.cpp
b/lib/Transforms/Utils/ValueMapper.cpp
index c9e474da8af4cb2785d010e26f575335d402dbf0..414d4eaa68dedeb499c25e76336a244e3d2fab3a 100644
(file)
--- a/
lib/Transforms/Utils/ValueMapper.cpp
+++ b/
lib/Transforms/Utils/ValueMapper.cpp
@@
-19,6
+19,7
@@
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Metadata.h"
+#include "llvm/IR/Operator.h"
using namespace llvm;
// Out of line method to get vtable etc for class.
using namespace llvm;
// Out of line method to get vtable etc for class.
@@
-127,9
+128,13
@@
Value *llvm::MapValue(const Value *V, ValueToValueMapTy &VM, RemapFlags Flags,
Ops.push_back(MapValue(cast<Constant>(C->getOperand(OpNo)), VM,
Flags, TypeMapper, Materializer));
}
Ops.push_back(MapValue(cast<Constant>(C->getOperand(OpNo)), VM,
Flags, TypeMapper, Materializer));
}
-
+ Type *NewSrcTy = nullptr;
+ if (TypeMapper)
+ if (auto *GEPO = dyn_cast<GEPOperator>(C))
+ NewSrcTy = TypeMapper->remapType(GEPO->getSourceElementType());
+
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
- return VM[V] = CE->getWithOperands(Ops, NewTy);
+ return VM[V] = CE->getWithOperands(Ops, NewTy
, false, NewSrcTy
);
if (isa<ConstantArray>(C))
return VM[V] = ConstantArray::get(cast<ArrayType>(NewTy), Ops);
if (isa<ConstantStruct>(C))
if (isa<ConstantArray>(C))
return VM[V] = ConstantArray::get(cast<ArrayType>(NewTy), Ops);
if (isa<ConstantStruct>(C))