forked from OSchip/llvm-project
[lldb] Avoid pointer element type accesses
This commit is contained in:
parent
406bde9a15
commit
840bb72543
|
@ -1757,20 +1757,19 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) {
|
||||||
llvm::Instruction *entry_instruction = llvm::cast<Instruction>(
|
llvm::Instruction *entry_instruction = llvm::cast<Instruction>(
|
||||||
m_entry_instruction_finder.GetValue(function));
|
m_entry_instruction_finder.GetValue(function));
|
||||||
|
|
||||||
|
Type *int8Ty = Type::getInt8Ty(function->getContext());
|
||||||
ConstantInt *offset_int(
|
ConstantInt *offset_int(
|
||||||
ConstantInt::get(offset_type, offset, true));
|
ConstantInt::get(offset_type, offset, true));
|
||||||
GetElementPtrInst *get_element_ptr = GetElementPtrInst::Create(
|
GetElementPtrInst *get_element_ptr = GetElementPtrInst::Create(
|
||||||
argument->getType()->getPointerElementType(), argument,
|
int8Ty, argument, offset_int, "", entry_instruction);
|
||||||
offset_int, "", entry_instruction);
|
|
||||||
|
|
||||||
if (name == m_result_name && !m_result_is_pointer) {
|
if (name == m_result_name && !m_result_is_pointer) {
|
||||||
BitCastInst *bit_cast = new BitCastInst(
|
BitCastInst *bit_cast = new BitCastInst(
|
||||||
get_element_ptr, value->getType()->getPointerTo(), "",
|
get_element_ptr, value->getType()->getPointerTo(), "",
|
||||||
entry_instruction);
|
entry_instruction);
|
||||||
|
|
||||||
LoadInst *load =
|
LoadInst *load = new LoadInst(value->getType(), bit_cast, "",
|
||||||
new LoadInst(bit_cast->getType()->getPointerElementType(),
|
entry_instruction);
|
||||||
bit_cast, "", entry_instruction);
|
|
||||||
|
|
||||||
return load;
|
return load;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -204,8 +204,6 @@ open problems:
|
||||||
|
|
||||||
* Some pointer element type uses remain in LLVM.
|
* Some pointer element type uses remain in LLVM.
|
||||||
|
|
||||||
* Some pointer element type uses remain in LLDB.
|
|
||||||
|
|
||||||
* Some pointer element type uses remain in MLIR.
|
* Some pointer element type uses remain in MLIR.
|
||||||
|
|
||||||
* Some pointer element type uses remain in Polly.
|
* Some pointer element type uses remain in Polly.
|
||||||
|
|
Loading…
Reference in New Issue