63 changes: 33 additions & 30 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,22 @@ lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::
Update();
}

bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() {
lldb::ChildCacheState
lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() {
m_pair_sp.reset();
m_pair_ptr = nullptr;

ValueObjectSP valobj_sp = m_backend.GetSP();
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;

TargetSP target_sp(valobj_sp->GetTargetSP());

if (!target_sp)
return false;
return lldb::ChildCacheState::eRefetch;

if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;

// this must be a ValueObject* because it is a child of the ValueObject we
// are producing children for it if were a ValueObjectSP, we would end up
Expand Down Expand Up @@ -278,7 +279,7 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() {
auto __i_(valobj_sp->GetChildMemberWithName("__i_"));
if (!__i_) {
m_pair_ptr = nullptr;
return false;
return lldb::ChildCacheState::eRefetch;
}
CompilerType pair_type(
__i_->GetCompilerType().GetTypeTemplateArgument(0));
Expand All @@ -290,7 +291,7 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() {
0, name, &bit_offset_ptr, &bitfield_bit_size_ptr, &is_bitfield_ptr);
if (!pair_type) {
m_pair_ptr = nullptr;
return false;
return lldb::ChildCacheState::eRefetch;
}

auto addr(m_pair_ptr->GetValueAsUnsigned(LLDB_INVALID_ADDRESS));
Expand All @@ -299,7 +300,7 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() {
auto ts = pair_type.GetTypeSystem();
auto ast_ctx = ts.dyn_cast_or_null<TypeSystemClang>();
if (!ast_ctx)
return false;
return lldb::ChildCacheState::eRefetch;

// Mimick layout of std::__tree_iterator::__ptr_ and read it in
// from process memory.
Expand Down Expand Up @@ -328,14 +329,14 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() {
{"payload", pair_type}});
std::optional<uint64_t> size = tree_node_type.GetByteSize(nullptr);
if (!size)
return false;
return lldb::ChildCacheState::eRefetch;
WritableDataBufferSP buffer_sp(new DataBufferHeap(*size, 0));
ProcessSP process_sp(target_sp->GetProcessSP());
Status error;
process_sp->ReadMemory(addr, buffer_sp->GetBytes(),
buffer_sp->GetByteSize(), error);
if (error.Fail())
return false;
return lldb::ChildCacheState::eRefetch;
DataExtractor extractor(buffer_sp, process_sp->GetByteOrder(),
process_sp->GetAddressByteSize());
auto pair_sp = CreateValueObjectFromData(
Expand All @@ -347,7 +348,7 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() {
}
}

return false;
return lldb::ChildCacheState::eRefetch;
}

size_t lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::
Expand Down Expand Up @@ -399,22 +400,22 @@ lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd::
Update();
}

bool lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd::
Update() {
lldb::ChildCacheState lldb_private::formatters::
LibCxxUnorderedMapIteratorSyntheticFrontEnd::Update() {
m_pair_sp.reset();
m_iter_ptr = nullptr;

ValueObjectSP valobj_sp = m_backend.GetSP();
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;

TargetSP target_sp(valobj_sp->GetTargetSP());

if (!target_sp)
return false;
return lldb::ChildCacheState::eRefetch;

if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;

auto exprPathOptions = ValueObject::GetValueForExpressionPathOptions()
.DontCheckDotVsArrowSyntax()
Expand All @@ -437,7 +438,7 @@ bool lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd::
auto iter_child(valobj_sp->GetChildMemberWithName("__i_"));
if (!iter_child) {
m_iter_ptr = nullptr;
return false;
return lldb::ChildCacheState::eRefetch;
}

CompilerType node_type(iter_child->GetCompilerType()
Expand All @@ -455,19 +456,19 @@ bool lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd::
0, name, &bit_offset_ptr, &bitfield_bit_size_ptr, &is_bitfield_ptr);
if (!pair_type) {
m_iter_ptr = nullptr;
return false;
return lldb::ChildCacheState::eRefetch;
}

uint64_t addr = m_iter_ptr->GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
m_iter_ptr = nullptr;

if (addr == 0 || addr == LLDB_INVALID_ADDRESS)
return false;
return lldb::ChildCacheState::eRefetch;

auto ts = pair_type.GetTypeSystem();
auto ast_ctx = ts.dyn_cast_or_null<TypeSystemClang>();
if (!ast_ctx)
return false;
return lldb::ChildCacheState::eRefetch;

// Mimick layout of std::__hash_iterator::__node_ and read it in
// from process memory.
Expand All @@ -489,14 +490,14 @@ bool lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd::
{"__value_", pair_type}});
std::optional<uint64_t> size = tree_node_type.GetByteSize(nullptr);
if (!size)
return false;
return lldb::ChildCacheState::eRefetch;
WritableDataBufferSP buffer_sp(new DataBufferHeap(*size, 0));
ProcessSP process_sp(target_sp->GetProcessSP());
Status error;
process_sp->ReadMemory(addr, buffer_sp->GetBytes(),
buffer_sp->GetByteSize(), error);
if (error.Fail())
return false;
return lldb::ChildCacheState::eRefetch;
DataExtractor extractor(buffer_sp, process_sp->GetByteOrder(),
process_sp->GetAddressByteSize());
auto pair_sp = CreateValueObjectFromData(
Expand All @@ -505,7 +506,7 @@ bool lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd::
m_pair_sp = pair_sp->GetChildAtIndex(2);
}

return false;
return lldb::ChildCacheState::eRefetch;
}

size_t lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd::
Expand Down Expand Up @@ -600,22 +601,23 @@ lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEnd::GetChildAtIndex(
return lldb::ValueObjectSP();
}

bool lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEnd::Update() {
lldb::ChildCacheState
lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEnd::Update() {
m_cntrl = nullptr;

ValueObjectSP valobj_sp = m_backend.GetSP();
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;

TargetSP target_sp(valobj_sp->GetTargetSP());
if (!target_sp)
return false;
return lldb::ChildCacheState::eRefetch;

lldb::ValueObjectSP cntrl_sp(valobj_sp->GetChildMemberWithName("__cntrl_"));

m_cntrl = cntrl_sp.get(); // need to store the raw pointer to avoid a circular
// dependency
return false;
return lldb::ChildCacheState::eRefetch;
}

bool lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEnd::
Expand Down Expand Up @@ -689,14 +691,15 @@ lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEnd::GetChildAtIndex(
return lldb::ValueObjectSP();
}

bool lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEnd::Update() {
lldb::ChildCacheState
lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEnd::Update() {
ValueObjectSP valobj_sp = m_backend.GetSP();
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;

ValueObjectSP ptr_sp(valobj_sp->GetChildMemberWithName("__ptr_"));
if (!ptr_sp)
return false;
return lldb::ChildCacheState::eRefetch;

// Retrieve the actual pointer and the deleter, and clone them to give them
// user-friendly names.
Expand All @@ -708,7 +711,7 @@ bool lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEnd::Update() {
if (deleter_sp)
m_deleter_sp = deleter_sp->Clone(ConstString("deleter"));

return false;
return lldb::ChildCacheState::eRefetch;
}

bool lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEnd::
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class LibCxxMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -139,7 +139,7 @@ class LibCxxUnorderedMapIteratorSyntheticFrontEnd

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -170,7 +170,7 @@ class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand All @@ -190,7 +190,7 @@ class LibcxxUniquePtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down
7 changes: 4 additions & 3 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class LibcxxStdAtomicSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand All @@ -110,12 +110,13 @@ lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::
LibcxxStdAtomicSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
: SyntheticChildrenFrontEnd(*valobj_sp) {}

bool lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::Update() {
lldb::ChildCacheState
lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::Update() {
ValueObjectSP atomic_value = GetLibCxxAtomicValue(m_backend);
if (atomic_value)
m_real_child = GetLibCxxAtomicValue(m_backend).get();

return false;
return lldb::ChildCacheState::eRefetch;
}

bool lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::
Expand Down
10 changes: 5 additions & 5 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LibcxxInitializerListSyntheticFrontEnd

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -82,21 +82,21 @@ lldb::ValueObjectSP lldb_private::formatters::
m_element_type);
}

bool lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
Update() {
lldb::ChildCacheState
lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::Update() {
m_start = nullptr;
m_num_elements = 0;
m_element_type = m_backend.GetCompilerType().GetTypeTemplateArgument(0);
if (!m_element_type.IsValid())
return false;
return lldb::ChildCacheState::eRefetch;

if (std::optional<uint64_t> size = m_element_type.GetByteSize(nullptr)) {
m_element_size = *size;
// Store raw pointers or end up with a circular dependency.
m_start = m_backend.GetChildMemberWithName("__begin_").get();
}

return false;
return lldb::ChildCacheState::eRefetch;
}

bool lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
Expand Down
32 changes: 16 additions & 16 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class AbstractListFrontEnd : public SyntheticChildrenFrontEnd {
return ExtractIndexFromString(name.GetCString());
}
bool MightHaveChildren() override { return true; }
bool Update() override;
lldb::ChildCacheState Update() override;

protected:
AbstractListFrontEnd(ValueObject &valobj)
Expand Down Expand Up @@ -138,7 +138,7 @@ class ForwardListFrontEnd : public AbstractListFrontEnd {

size_t CalculateNumChildren() override;
ValueObjectSP GetChildAtIndex(size_t idx) override;
bool Update() override;
lldb::ChildCacheState Update() override;
};

class ListFrontEnd : public AbstractListFrontEnd {
Expand All @@ -151,7 +151,7 @@ class ListFrontEnd : public AbstractListFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

private:
lldb::addr_t m_node_address = 0;
Expand All @@ -160,7 +160,7 @@ class ListFrontEnd : public AbstractListFrontEnd {

} // end anonymous namespace

bool AbstractListFrontEnd::Update() {
lldb::ChildCacheState AbstractListFrontEnd::Update() {
m_loop_detected = 0;
m_count = UINT32_MAX;
m_head = nullptr;
Expand All @@ -180,10 +180,10 @@ bool AbstractListFrontEnd::Update() {
list_type = list_type.GetNonReferenceType();

if (list_type.GetNumTemplateArguments() == 0)
return false;
return lldb::ChildCacheState::eRefetch;
m_element_type = list_type.GetTypeTemplateArgument(0);

return false;
return lldb::ChildCacheState::eRefetch;
}

bool AbstractListFrontEnd::HasLoop(size_t count) {
Expand Down Expand Up @@ -284,22 +284,22 @@ ValueObjectSP ForwardListFrontEnd::GetChildAtIndex(size_t idx) {
m_element_type);
}

bool ForwardListFrontEnd::Update() {
lldb::ChildCacheState ForwardListFrontEnd::Update() {
AbstractListFrontEnd::Update();

Status err;
ValueObjectSP backend_addr(m_backend.AddressOf(err));
if (err.Fail() || !backend_addr)
return false;
return lldb::ChildCacheState::eRefetch;

ValueObjectSP impl_sp(m_backend.GetChildMemberWithName("__before_begin_"));
if (!impl_sp)
return false;
return lldb::ChildCacheState::eRefetch;
impl_sp = GetFirstValueOfLibCXXCompressedPair(*impl_sp);
if (!impl_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_head = impl_sp->GetChildMemberWithName("__next_").get();
return false;
return lldb::ChildCacheState::eRefetch;
}

ListFrontEnd::ListFrontEnd(lldb::ValueObjectSP valobj_sp)
Expand Down Expand Up @@ -394,24 +394,24 @@ lldb::ValueObjectSP ListFrontEnd::GetChildAtIndex(size_t idx) {
m_element_type);
}

bool ListFrontEnd::Update() {
lldb::ChildCacheState ListFrontEnd::Update() {
AbstractListFrontEnd::Update();
m_tail = nullptr;
m_node_address = 0;

Status err;
ValueObjectSP backend_addr(m_backend.AddressOf(err));
if (err.Fail() || !backend_addr)
return false;
return lldb::ChildCacheState::eRefetch;
m_node_address = backend_addr->GetValueAsUnsigned(0);
if (!m_node_address || m_node_address == LLDB_INVALID_ADDRESS)
return false;
return lldb::ChildCacheState::eRefetch;
ValueObjectSP impl_sp(m_backend.GetChildMemberWithName("__end_"));
if (!impl_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_head = impl_sp->GetChildMemberWithName("__next_").get();
m_tail = impl_sp->GetChildMemberWithName("__prev_").get();
return false;
return lldb::ChildCacheState::eRefetch;
}

SyntheticChildrenFrontEnd *formatters::LibcxxStdListSyntheticFrontEndCreator(
Expand Down
9 changes: 5 additions & 4 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class LibcxxStdMapSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -405,15 +405,16 @@ lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetChildAtIndex(
return potential_child_sp;
}

bool lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::Update() {
lldb::ChildCacheState
lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::Update() {
m_count = UINT32_MAX;
m_tree = m_root_node = nullptr;
m_iterators.clear();
m_tree = m_backend.GetChildMemberWithName("__tree_").get();
if (!m_tree)
return false;
return lldb::ChildCacheState::eRefetch;
m_root_node = m_tree->GetChildMemberWithName("__begin_node_").get();
return false;
return lldb::ChildCacheState::eRefetch;
}

bool lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class QueueFrontEnd : public SyntheticChildrenFrontEnd {
}

bool MightHaveChildren() override { return true; }
bool Update() override;
lldb::ChildCacheState Update() override;

size_t CalculateNumChildren() override {
return m_container_sp ? m_container_sp->GetNumChildren() : 0;
Expand All @@ -47,13 +47,13 @@ class QueueFrontEnd : public SyntheticChildrenFrontEnd {
};
} // namespace

bool QueueFrontEnd::Update() {
lldb::ChildCacheState QueueFrontEnd::Update() {
m_container_sp = nullptr;
ValueObjectSP c_sp = m_backend.GetChildMemberWithName("c");
if (!c_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_container_sp = c_sp->GetSyntheticValue().get();
return false;
return lldb::ChildCacheState::eRefetch;
}

SyntheticChildrenFrontEnd *
Expand Down
11 changes: 6 additions & 5 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class LibcxxStdRangesRefViewSyntheticFrontEnd
return m_range_sp;
}

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override { return true; }

Expand All @@ -59,17 +59,18 @@ lldb_private::formatters::LibcxxStdRangesRefViewSyntheticFrontEnd::
Update();
}

bool lldb_private::formatters::LibcxxStdRangesRefViewSyntheticFrontEnd::
Update() {
lldb::ChildCacheState
lldb_private::formatters::LibcxxStdRangesRefViewSyntheticFrontEnd::Update() {
ValueObjectSP range_ptr =
GetChildMemberWithName(m_backend, {ConstString("__range_")});
if (!range_ptr)
return false;
return lldb::ChildCacheState::eRefetch;

lldb_private::Status error;
m_range_sp = range_ptr->Dereference(error);

return error.Success();
return error.Success() ? lldb::ChildCacheState::eReuse
: lldb::ChildCacheState::eRefetch;
}

lldb_private::SyntheticChildrenFrontEnd *
Expand Down
9 changes: 5 additions & 4 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class LibcxxStdSpanSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
// This function checks for a '__size' member to determine the number
// of elements in the span. If no such member exists, we get the size
// from the only other place it can be: the template argument.
bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -93,12 +93,13 @@ lldb_private::formatters::LibcxxStdSpanSyntheticFrontEnd::GetChildAtIndex(
m_element_type);
}

bool lldb_private::formatters::LibcxxStdSpanSyntheticFrontEnd::Update() {
lldb::ChildCacheState
lldb_private::formatters::LibcxxStdSpanSyntheticFrontEnd::Update() {
// Get element type.
ValueObjectSP data_type_finder_sp = GetChildMemberWithName(
m_backend, {ConstString("__data_"), ConstString("__data")});
if (!data_type_finder_sp)
return false;
return lldb::ChildCacheState::eRefetch;

m_element_type = data_type_finder_sp->GetCompilerType().GetPointeeType();

Expand All @@ -122,7 +123,7 @@ bool lldb_private::formatters::LibcxxStdSpanSyntheticFrontEnd::Update() {
}
}

return true;
return lldb::ChildCacheState::eReuse;
}

bool lldb_private::formatters::LibcxxStdSpanSyntheticFrontEnd::
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TupleFrontEnd: public SyntheticChildrenFrontEnd {
}

bool MightHaveChildren() override { return true; }
bool Update() override;
lldb::ChildCacheState Update() override;
size_t CalculateNumChildren() override { return m_elements.size(); }
ValueObjectSP GetChildAtIndex(size_t idx) override;

Expand All @@ -40,7 +40,7 @@ class TupleFrontEnd: public SyntheticChildrenFrontEnd {
};
}

bool TupleFrontEnd::Update() {
lldb::ChildCacheState TupleFrontEnd::Update() {
m_elements.clear();
m_base = nullptr;

Expand All @@ -51,11 +51,11 @@ bool TupleFrontEnd::Update() {
base_sp = m_backend.GetChildMemberWithName("base_");
}
if (!base_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_base = base_sp.get();
m_elements.assign(base_sp->GetCompilerType().GetNumDirectBaseClasses(),
nullptr);
return false;
return lldb::ChildCacheState::eRefetch;
}

ValueObjectSP TupleFrontEnd::GetChildAtIndex(size_t idx) {
Expand Down
20 changes: 10 additions & 10 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class LibcxxStdUnorderedMapSyntheticFrontEnd

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -193,41 +193,41 @@ lldb::ValueObjectSP lldb_private::formatters::
m_element_type);
}

bool lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::
Update() {
lldb::ChildCacheState
lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::Update() {
m_num_elements = 0;
m_next_element = nullptr;
m_elements_cache.clear();
ValueObjectSP table_sp = m_backend.GetChildMemberWithName("__table_");
if (!table_sp)
return false;
return lldb::ChildCacheState::eRefetch;

ValueObjectSP p2_sp = table_sp->GetChildMemberWithName("__p2_");
if (!p2_sp)
return false;
return lldb::ChildCacheState::eRefetch;

ValueObjectSP num_elements_sp = GetFirstValueOfLibCXXCompressedPair(*p2_sp);
if (!num_elements_sp)
return false;
return lldb::ChildCacheState::eRefetch;

ValueObjectSP p1_sp = table_sp->GetChildMemberWithName("__p1_");
if (!p1_sp)
return false;
return lldb::ChildCacheState::eRefetch;

ValueObjectSP value_sp = GetFirstValueOfLibCXXCompressedPair(*p1_sp);
if (!value_sp)
return false;
return lldb::ChildCacheState::eRefetch;

m_tree = value_sp->GetChildMemberWithName("__next_").get();
if (m_tree == nullptr)
return false;
return lldb::ChildCacheState::eRefetch;

m_num_elements = num_elements_sp->GetValueAsUnsigned(0);

if (m_num_elements > 0)
m_next_element = m_tree;

return false;
return lldb::ChildCacheState::eRefetch;
}

bool lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::
Expand Down
12 changes: 6 additions & 6 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class VariantFrontEnd : public SyntheticChildrenFrontEnd {
}

bool MightHaveChildren() override { return true; }
bool Update() override;
lldb::ChildCacheState Update() override;
size_t CalculateNumChildren() override { return m_size; }
ValueObjectSP GetChildAtIndex(size_t idx) override;

Expand All @@ -213,24 +213,24 @@ class VariantFrontEnd : public SyntheticChildrenFrontEnd {
};
} // namespace

bool VariantFrontEnd::Update() {
lldb::ChildCacheState VariantFrontEnd::Update() {
m_size = 0;
ValueObjectSP impl_sp = formatters::GetChildMemberWithName(
m_backend, {ConstString("__impl_"), ConstString("__impl")});
if (!impl_sp)
return false;
return lldb::ChildCacheState::eRefetch;

LibcxxVariantIndexValidity validity = LibcxxVariantGetIndexValidity(impl_sp);

if (validity == LibcxxVariantIndexValidity::Invalid)
return false;
return lldb::ChildCacheState::eRefetch;

if (validity == LibcxxVariantIndexValidity::NPos)
return true;
return lldb::ChildCacheState::eReuse;

m_size = 1;

return false;
return lldb::ChildCacheState::eRefetch;
}

ValueObjectSP VariantFrontEnd::GetChildAtIndex(size_t idx) {
Expand Down
28 changes: 15 additions & 13 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class LibcxxStdVectorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand All @@ -50,7 +50,7 @@ class LibcxxVectorBoolSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override { return true; }

Expand Down Expand Up @@ -116,17 +116,18 @@ lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::GetChildAtIndex(
m_element_type);
}

bool lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::Update() {
lldb::ChildCacheState
lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::Update() {
m_start = m_finish = nullptr;
ValueObjectSP data_type_finder_sp(
m_backend.GetChildMemberWithName("__end_cap_"));
if (!data_type_finder_sp)
return false;
return lldb::ChildCacheState::eRefetch;

data_type_finder_sp =
GetFirstValueOfLibCXXCompressedPair(*data_type_finder_sp);
if (!data_type_finder_sp)
return false;
return lldb::ChildCacheState::eRefetch;

m_element_type = data_type_finder_sp->GetCompilerType().GetPointeeType();
if (std::optional<uint64_t> size = m_element_type.GetByteSize(nullptr)) {
Expand All @@ -138,7 +139,7 @@ bool lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::Update() {
m_finish = m_backend.GetChildMemberWithName("__end_").get();
}
}
return false;
return lldb::ChildCacheState::eRefetch;
}

bool lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::
Expand Down Expand Up @@ -226,29 +227,30 @@ lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::GetChildAtIndex(
}
}*/

bool lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::Update() {
lldb::ChildCacheState
lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::Update() {
m_children.clear();
ValueObjectSP valobj_sp = m_backend.GetSP();
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
ValueObjectSP size_sp(valobj_sp->GetChildMemberWithName("__size_"));
if (!size_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_count = size_sp->GetValueAsUnsigned(0);
if (!m_count)
return true;
return lldb::ChildCacheState::eReuse;
ValueObjectSP begin_sp(valobj_sp->GetChildMemberWithName("__begin_"));
if (!begin_sp) {
m_count = 0;
return false;
return lldb::ChildCacheState::eRefetch;
}
m_base_data_address = begin_sp->GetValueAsUnsigned(0);
if (!m_base_data_address) {
m_count = 0;
return false;
return lldb::ChildCacheState::eRefetch;
}
return false;
return lldb::ChildCacheState::eRefetch;
}

size_t lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::
Expand Down
44 changes: 22 additions & 22 deletions lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class LibstdcppMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand All @@ -68,7 +68,7 @@ class LibStdcppSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand All @@ -94,42 +94,42 @@ LibstdcppMapIteratorSyntheticFrontEnd::LibstdcppMapIteratorSyntheticFrontEnd(
Update();
}

bool LibstdcppMapIteratorSyntheticFrontEnd::Update() {
lldb::ChildCacheState LibstdcppMapIteratorSyntheticFrontEnd::Update() {
ValueObjectSP valobj_sp = m_backend.GetSP();
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;

TargetSP target_sp(valobj_sp->GetTargetSP());

if (!target_sp)
return false;
return lldb::ChildCacheState::eRefetch;

bool is_64bit = (target_sp->GetArchitecture().GetAddressByteSize() == 8);

if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();

ValueObjectSP _M_node_sp(valobj_sp->GetChildMemberWithName("_M_node"));
if (!_M_node_sp)
return false;
return lldb::ChildCacheState::eRefetch;

m_pair_address = _M_node_sp->GetValueAsUnsigned(0);
if (m_pair_address == 0)
return false;
return lldb::ChildCacheState::eRefetch;

m_pair_address += (is_64bit ? 32 : 16);

CompilerType my_type(valobj_sp->GetCompilerType());
if (my_type.GetNumTemplateArguments() >= 1) {
CompilerType pair_type = my_type.GetTypeTemplateArgument(0);
if (!pair_type)
return false;
return lldb::ChildCacheState::eRefetch;
m_pair_type = pair_type;
} else
return false;
return lldb::ChildCacheState::eRefetch;

return true;
return lldb::ChildCacheState::eReuse;
}

size_t LibstdcppMapIteratorSyntheticFrontEnd::CalculateNumChildren() {
Expand Down Expand Up @@ -193,30 +193,30 @@ lldb_private::formatters::VectorIteratorSyntheticFrontEnd::
Update();
}

bool VectorIteratorSyntheticFrontEnd::Update() {
lldb::ChildCacheState VectorIteratorSyntheticFrontEnd::Update() {
m_item_sp.reset();

ValueObjectSP valobj_sp = m_backend.GetSP();
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;

if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;

ValueObjectSP item_ptr =
formatters::GetChildMemberWithName(*valobj_sp, m_item_names);
if (!item_ptr)
return false;
return lldb::ChildCacheState::eRefetch;
if (item_ptr->GetValueAsUnsigned(0) == 0)
return false;
return lldb::ChildCacheState::eRefetch;
Status err;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
m_item_sp = CreateValueObjectFromAddress(
"item", item_ptr->GetValueAsUnsigned(0), m_exe_ctx_ref,
item_ptr->GetCompilerType().GetPointeeType());
if (err.Fail())
m_item_sp.reset();
return false;
return lldb::ChildCacheState::eRefetch;
}

size_t VectorIteratorSyntheticFrontEnd::CalculateNumChildren() { return 1; }
Expand Down Expand Up @@ -390,23 +390,23 @@ LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(size_t idx) {
return lldb::ValueObjectSP();
}

bool LibStdcppSharedPtrSyntheticFrontEnd::Update() {
lldb::ChildCacheState LibStdcppSharedPtrSyntheticFrontEnd::Update() {
auto backend = m_backend.GetSP();
if (!backend)
return false;
return lldb::ChildCacheState::eRefetch;

auto valobj_sp = backend->GetNonSyntheticValue();
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;

auto ptr_obj_sp = valobj_sp->GetChildMemberWithName("_M_ptr");
if (!ptr_obj_sp)
return false;
return lldb::ChildCacheState::eRefetch;

m_ptr_obj = ptr_obj_sp->Clone(ConstString("pointer")).get();
m_obj_obj = nullptr;

return false;
return lldb::ChildCacheState::eRefetch;
}

bool LibStdcppSharedPtrSyntheticFrontEnd::MightHaveChildren() { return true; }
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LibStdcppTupleSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand All @@ -53,12 +53,12 @@ LibStdcppTupleSyntheticFrontEnd::LibStdcppTupleSyntheticFrontEnd(
Update();
}

bool LibStdcppTupleSyntheticFrontEnd::Update() {
lldb::ChildCacheState LibStdcppTupleSyntheticFrontEnd::Update() {
m_members.clear();

ValueObjectSP valobj_backend_sp = m_backend.GetSP();
if (!valobj_backend_sp)
return false;
return lldb::ChildCacheState::eRefetch;

ValueObjectSP next_child_sp = valobj_backend_sp->GetNonSyntheticValue();
while (next_child_sp != nullptr) {
Expand All @@ -83,7 +83,7 @@ bool LibStdcppTupleSyntheticFrontEnd::Update() {
}
}

return false;
return lldb::ChildCacheState::eRefetch;
}

bool LibStdcppTupleSyntheticFrontEnd::MightHaveChildren() { return true; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LibStdcppUniquePtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -84,11 +84,11 @@ ValueObjectSP LibStdcppUniquePtrSyntheticFrontEnd::GetTuple() {
return obj_child_sp;
}

bool LibStdcppUniquePtrSyntheticFrontEnd::Update() {
lldb::ChildCacheState LibStdcppUniquePtrSyntheticFrontEnd::Update() {
ValueObjectSP tuple_sp = GetTuple();

if (!tuple_sp)
return false;
return lldb::ChildCacheState::eRefetch;

std::unique_ptr<SyntheticChildrenFrontEnd> tuple_frontend(
LibStdcppTupleSyntheticFrontEndCreator(nullptr, tuple_sp));
Expand All @@ -110,7 +110,7 @@ bool LibStdcppUniquePtrSyntheticFrontEnd::Update() {
}
m_obj_obj = nullptr;

return false;
return lldb::ChildCacheState::eRefetch;
}

bool LibStdcppUniquePtrSyntheticFrontEnd::MightHaveChildren() { return true; }
Expand Down
4 changes: 3 additions & 1 deletion lldb/source/Plugins/Language/ObjC/Cocoa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,9 @@ class ObjCClassSyntheticChildrenFrontEnd : public SyntheticChildrenFrontEnd {
return lldb::ValueObjectSP();
}

bool Update() override { return false; }
lldb::ChildCacheState Update() override {
return lldb::ChildCacheState::eRefetch;
}

bool MightHaveChildren() override { return false; }

Expand Down
45 changes: 24 additions & 21 deletions lldb/source/Plugins/Language/ObjC/NSArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class NSArrayMSyntheticFrontEndBase : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override = 0;
lldb::ChildCacheState Update() override = 0;

bool MightHaveChildren() override;

Expand All @@ -81,7 +81,7 @@ class GenericNSArrayMSyntheticFrontEnd : public NSArrayMSyntheticFrontEndBase {

~GenericNSArrayMSyntheticFrontEnd() override;

bool Update() override;
lldb::ChildCacheState Update() override;

protected:
lldb::addr_t GetDataAddress() override;
Expand Down Expand Up @@ -218,7 +218,7 @@ class GenericNSArrayISyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -306,7 +306,7 @@ class NSArray0SyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand All @@ -323,7 +323,7 @@ class NSArray1SyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -500,23 +500,22 @@ lldb_private::formatters::NSArrayMSyntheticFrontEndBase::GetChildAtIndex(
}

template <typename D32, typename D64>
bool
lldb_private::formatters::
GenericNSArrayMSyntheticFrontEnd<D32, D64>::Update() {
lldb::ChildCacheState
lldb_private::formatters::GenericNSArrayMSyntheticFrontEnd<D32, D64>::Update() {
ValueObjectSP valobj_sp = m_backend.GetSP();
m_ptr_size = 0;
delete m_data_32;
m_data_32 = nullptr;
delete m_data_64;
m_data_64 = nullptr;
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
Status error;
error.Clear();
lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
if (!process_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_ptr_size = process_sp->GetAddressByteSize();
uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
if (m_ptr_size == 4) {
Expand All @@ -529,7 +528,8 @@ lldb_private::formatters::
error);
}

return error.Success();
return error.Success() ? lldb::ChildCacheState::eReuse
: lldb::ChildCacheState::eRefetch;
}

bool
Expand Down Expand Up @@ -641,23 +641,23 @@ lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
}

template <typename D32, typename D64, bool Inline>
bool
lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
Update() {
lldb::ChildCacheState
lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64,
Inline>::Update() {
ValueObjectSP valobj_sp = m_backend.GetSP();
m_ptr_size = 0;
delete m_data_32;
m_data_32 = nullptr;
delete m_data_64;
m_data_64 = nullptr;
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
Status error;
error.Clear();
lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
if (!process_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_ptr_size = process_sp->GetAddressByteSize();
uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
if (m_ptr_size == 4) {
Expand All @@ -670,7 +670,8 @@ lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
error);
}

return error.Success();
return error.Success() ? lldb::ChildCacheState::eReuse
: lldb::ChildCacheState::eRefetch;
}

template <typename D32, typename D64, bool Inline>
Expand Down Expand Up @@ -723,8 +724,9 @@ lldb_private::formatters::NSArray0SyntheticFrontEnd::CalculateNumChildren() {
return 0;
}

bool lldb_private::formatters::NSArray0SyntheticFrontEnd::Update() {
return false;
lldb::ChildCacheState
lldb_private::formatters::NSArray0SyntheticFrontEnd::Update() {
return lldb::ChildCacheState::eRefetch;
}

bool lldb_private::formatters::NSArray0SyntheticFrontEnd::MightHaveChildren() {
Expand Down Expand Up @@ -757,8 +759,9 @@ lldb_private::formatters::NSArray1SyntheticFrontEnd::CalculateNumChildren() {
return 1;
}

bool lldb_private::formatters::NSArray1SyntheticFrontEnd::Update() {
return false;
lldb::ChildCacheState
lldb_private::formatters::NSArray1SyntheticFrontEnd::Update() {
return lldb::ChildCacheState::eRefetch;
}

bool lldb_private::formatters::NSArray1SyntheticFrontEnd::MightHaveChildren() {
Expand Down
83 changes: 46 additions & 37 deletions lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class NSDictionaryISyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -148,7 +148,7 @@ class NSConstantDictionarySyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -180,7 +180,7 @@ class NSCFDictionarySyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -213,7 +213,7 @@ class NSDictionary1SyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand All @@ -234,7 +234,7 @@ class GenericNSDictionaryMSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -266,9 +266,9 @@ namespace Foundation1100 {
size_t CalculateNumChildren() override;

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
bool Update() override;

lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

size_t GetIndexOfChildWithName(ConstString name) override;
Expand Down Expand Up @@ -613,7 +613,8 @@ size_t lldb_private::formatters::NSDictionaryISyntheticFrontEnd::
return (m_data_32 ? m_data_32->_used : m_data_64->_used);
}

bool lldb_private::formatters::NSDictionaryISyntheticFrontEnd::Update() {
lldb::ChildCacheState
lldb_private::formatters::NSDictionaryISyntheticFrontEnd::Update() {
m_children.clear();
delete m_data_32;
m_data_32 = nullptr;
Expand All @@ -622,13 +623,13 @@ bool lldb_private::formatters::NSDictionaryISyntheticFrontEnd::Update() {
m_ptr_size = 0;
ValueObjectSP valobj_sp = m_backend.GetSP();
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
Status error;
error.Clear();
lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
if (!process_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_ptr_size = process_sp->GetAddressByteSize();
m_order = process_sp->GetByteOrder();
uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
Expand All @@ -642,9 +643,9 @@ bool lldb_private::formatters::NSDictionaryISyntheticFrontEnd::Update() {
error);
}
if (error.Fail())
return false;
return lldb::ChildCacheState::eRefetch;
m_data_ptr = data_location + m_ptr_size;
return false;
return lldb::ChildCacheState::eRefetch;
}

bool lldb_private::formatters::NSDictionaryISyntheticFrontEnd::
Expand Down Expand Up @@ -750,20 +751,23 @@ size_t lldb_private::formatters::NSCFDictionarySyntheticFrontEnd::
return m_hashtable.GetCount();
}

bool lldb_private::formatters::NSCFDictionarySyntheticFrontEnd::Update() {
lldb::ChildCacheState
lldb_private::formatters::NSCFDictionarySyntheticFrontEnd::Update() {
m_children.clear();
ValueObjectSP valobj_sp = m_backend.GetSP();
m_ptr_size = 0;
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();

lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
if (!process_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_ptr_size = process_sp->GetAddressByteSize();
m_order = process_sp->GetByteOrder();
return m_hashtable.Update(valobj_sp->GetValueAsUnsigned(0), m_exe_ctx_ref);
return m_hashtable.Update(valobj_sp->GetValueAsUnsigned(0), m_exe_ctx_ref)
? lldb::ChildCacheState::eReuse
: lldb::ChildCacheState::eRefetch;
}

bool lldb_private::formatters::NSCFDictionarySyntheticFrontEnd::
Expand Down Expand Up @@ -881,30 +885,33 @@ size_t lldb_private::formatters::NSConstantDictionarySyntheticFrontEnd::
return m_size;
}

bool lldb_private::formatters::NSConstantDictionarySyntheticFrontEnd::Update() {
lldb::ChildCacheState
lldb_private::formatters::NSConstantDictionarySyntheticFrontEnd::Update() {
ValueObjectSP valobj_sp = m_backend.GetSP();
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
Status error;
error.Clear();
lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
if (!process_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_ptr_size = process_sp->GetAddressByteSize();
m_order = process_sp->GetByteOrder();
uint64_t valobj_addr = valobj_sp->GetValueAsUnsigned(0);
m_size = process_sp->ReadUnsignedIntegerFromMemory(
valobj_addr + 2 * m_ptr_size, m_ptr_size, 0, error);
if (error.Fail())
return false;
return lldb::ChildCacheState::eRefetch;
m_keys_ptr =
process_sp->ReadPointerFromMemory(valobj_addr + 3 * m_ptr_size, error);
if (error.Fail())
return false;
return lldb::ChildCacheState::eRefetch;
m_objects_ptr =
process_sp->ReadPointerFromMemory(valobj_addr + 4 * m_ptr_size, error);
return !error.Fail();

return error.Success() ? lldb::ChildCacheState::eReuse
: lldb::ChildCacheState::eRefetch;
}

bool lldb_private::formatters::NSConstantDictionarySyntheticFrontEnd::
Expand Down Expand Up @@ -992,9 +999,10 @@ size_t lldb_private::formatters::NSDictionary1SyntheticFrontEnd::
return 1;
}

bool lldb_private::formatters::NSDictionary1SyntheticFrontEnd::Update() {
lldb::ChildCacheState
lldb_private::formatters::NSDictionary1SyntheticFrontEnd::Update() {
m_pair.reset();
return false;
return lldb::ChildCacheState::eRefetch;
}

bool lldb_private::formatters::NSDictionary1SyntheticFrontEnd::
Expand Down Expand Up @@ -1087,9 +1095,9 @@ lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>::Calcul
}

template <typename D32, typename D64>
bool
lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>::
Update() {
lldb::ChildCacheState
lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,
D64>::Update() {
m_children.clear();
ValueObjectSP valobj_sp = m_backend.GetSP();
m_ptr_size = 0;
Expand All @@ -1098,13 +1106,13 @@ lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>::
delete m_data_64;
m_data_64 = nullptr;
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
Status error;
error.Clear();
lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
if (!process_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_ptr_size = process_sp->GetAddressByteSize();
m_order = process_sp->GetByteOrder();
uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
Expand All @@ -1118,7 +1126,8 @@ lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>::
error);
}

return error.Success();
return error.Success() ? lldb::ChildCacheState::eReuse
: lldb::ChildCacheState::eRefetch;
}

template <typename D32, typename D64>
Expand Down Expand Up @@ -1249,9 +1258,8 @@ lldb_private::formatters::Foundation1100::
return (m_data_32 ? m_data_32->_used : m_data_64->_used);
}

bool
lldb_private::formatters::Foundation1100::
NSDictionaryMSyntheticFrontEnd::Update() {
lldb::ChildCacheState lldb_private::formatters::Foundation1100::
NSDictionaryMSyntheticFrontEnd::Update() {
m_children.clear();
ValueObjectSP valobj_sp = m_backend.GetSP();
m_ptr_size = 0;
Expand All @@ -1260,13 +1268,13 @@ lldb_private::formatters::Foundation1100::
delete m_data_64;
m_data_64 = nullptr;
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
Status error;
error.Clear();
lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
if (!process_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_ptr_size = process_sp->GetAddressByteSize();
m_order = process_sp->GetByteOrder();
uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
Expand All @@ -1280,7 +1288,8 @@ lldb_private::formatters::Foundation1100::
error);
}

return error.Success();
return error.Success() ? lldb::ChildCacheState::eReuse
: lldb::ChildCacheState::eRefetch;
}

bool
Expand Down
12 changes: 6 additions & 6 deletions lldb/source/Plugins/Language/ObjC/NSError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,17 @@ class NSErrorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
return m_child_sp;
}

bool Update() override {
lldb::ChildCacheState Update() override {
m_child_ptr = nullptr;
m_child_sp.reset();

ProcessSP process_sp(m_backend.GetProcessSP());
if (!process_sp)
return false;
return lldb::ChildCacheState::eRefetch;

lldb::addr_t userinfo_location = DerefToNSErrorPointer(m_backend);
if (userinfo_location == LLDB_INVALID_ADDRESS)
return false;
return lldb::ChildCacheState::eRefetch;

size_t ptr_size = process_sp->GetAddressByteSize();

Expand All @@ -152,17 +152,17 @@ class NSErrorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
lldb::addr_t userinfo =
process_sp->ReadPointerFromMemory(userinfo_location, error);
if (userinfo == LLDB_INVALID_ADDRESS || error.Fail())
return false;
return lldb::ChildCacheState::eRefetch;
InferiorSizedWord isw(userinfo, *process_sp);
TypeSystemClangSP scratch_ts_sp =
ScratchTypeSystemClang::GetForTarget(process_sp->GetTarget());
if (!scratch_ts_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_child_sp = CreateValueObjectFromData(
"_userInfo", isw.GetAsData(process_sp->GetByteOrder()),
m_backend.GetExecutionContextRef(),
scratch_ts_sp->GetBasicType(lldb::eBasicTypeObjCID));
return false;
return lldb::ChildCacheState::eRefetch;
}

bool MightHaveChildren() override { return true; }
Expand Down
9 changes: 6 additions & 3 deletions lldb/source/Plugins/Language/ObjC/NSException.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,17 @@ class NSExceptionSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
return lldb::ValueObjectSP();
}

bool Update() override {
lldb::ChildCacheState Update() override {
m_name_sp.reset();
m_reason_sp.reset();
m_userinfo_sp.reset();
m_reserved_sp.reset();

return ExtractFields(m_backend, &m_name_sp, &m_reason_sp, &m_userinfo_sp,
&m_reserved_sp);
const auto ret = ExtractFields(m_backend, &m_name_sp, &m_reason_sp,
&m_userinfo_sp, &m_reserved_sp);

return ret ? lldb::ChildCacheState::eReuse
: lldb::ChildCacheState::eRefetch;
}

bool MightHaveChildren() override { return true; }
Expand Down
14 changes: 7 additions & 7 deletions lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
return m_impl.GetIndexAtIndex(idx, m_uint_star_type);
}

bool Update() override {
lldb::ChildCacheState Update() override {
m_impl.Clear();

auto type_system = m_backend.GetCompilerType().GetTypeSystem();
if (!type_system)
return false;
return lldb::ChildCacheState::eRefetch;

auto ast = ScratchTypeSystemClang::GetForTarget(
*m_backend.GetExecutionContextRef().GetTargetSP());
if (!ast)
return false;
return lldb::ChildCacheState::eRefetch;

m_uint_star_type = ast->GetPointerSizedIntType(false);

Expand All @@ -65,18 +65,18 @@ class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

ProcessSP process_sp = m_backend.GetProcessSP();
if (!process_sp)
return false;
return lldb::ChildCacheState::eRefetch;

ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);

if (!runtime)
return false;
return lldb::ChildCacheState::eRefetch;

ObjCLanguageRuntime::ClassDescriptorSP descriptor(
runtime->GetClassDescriptor(m_backend));

if (!descriptor.get() || !descriptor->IsValid())
return false;
return lldb::ChildCacheState::eRefetch;

uint64_t info_bits(0), value_bits(0), payload(0);

Expand Down Expand Up @@ -119,7 +119,7 @@ class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
}
}
}
return false;
return lldb::ChildCacheState::eRefetch;
}

bool MightHaveChildren() override { return m_impl.m_mode != Mode::Invalid; }
Expand Down
46 changes: 25 additions & 21 deletions lldb/source/Plugins/Language/ObjC/NSSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class NSSetISyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -88,7 +88,7 @@ class NSCFSetSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -121,7 +121,7 @@ class GenericNSSetMSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -237,7 +237,7 @@ class NSSetCodeRunningSyntheticFrontEnd : public SyntheticChildrenFrontEnd {

lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;

bool Update() override;
lldb::ChildCacheState Update() override;

bool MightHaveChildren() override;

Expand Down Expand Up @@ -426,7 +426,8 @@ lldb_private::formatters::NSSetISyntheticFrontEnd::CalculateNumChildren() {
return (m_data_32 ? m_data_32->_used : m_data_64->_used);
}

bool lldb_private::formatters::NSSetISyntheticFrontEnd::Update() {
lldb::ChildCacheState
lldb_private::formatters::NSSetISyntheticFrontEnd::Update() {
m_children.clear();
delete m_data_32;
m_data_32 = nullptr;
Expand All @@ -435,13 +436,13 @@ bool lldb_private::formatters::NSSetISyntheticFrontEnd::Update() {
m_ptr_size = 0;
ValueObjectSP valobj_sp = m_backend.GetSP();
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
if (!process_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_ptr_size = process_sp->GetAddressByteSize();
uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
Status error;
Expand All @@ -455,9 +456,9 @@ bool lldb_private::formatters::NSSetISyntheticFrontEnd::Update() {
error);
}
if (error.Fail())
return false;
return lldb::ChildCacheState::eRefetch;
m_data_ptr = data_location + m_ptr_size;
return true;
return lldb::ChildCacheState::eReuse;
}

bool lldb_private::formatters::NSSetISyntheticFrontEnd::MightHaveChildren() {
Expand Down Expand Up @@ -561,20 +562,23 @@ lldb_private::formatters::NSCFSetSyntheticFrontEnd::CalculateNumChildren() {
return m_hashtable.GetCount();
}

bool lldb_private::formatters::NSCFSetSyntheticFrontEnd::Update() {
lldb::ChildCacheState
lldb_private::formatters::NSCFSetSyntheticFrontEnd::Update() {
m_children.clear();
ValueObjectSP valobj_sp = m_backend.GetSP();
m_ptr_size = 0;
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();

lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
if (!process_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_ptr_size = process_sp->GetAddressByteSize();
m_order = process_sp->GetByteOrder();
return m_hashtable.Update(valobj_sp->GetValueAsUnsigned(0), m_exe_ctx_ref);
return m_hashtable.Update(valobj_sp->GetValueAsUnsigned(0), m_exe_ctx_ref)
? lldb::ChildCacheState::eReuse
: lldb::ChildCacheState::eRefetch;
}

bool lldb_private::formatters::NSCFSetSyntheticFrontEnd::MightHaveChildren() {
Expand Down Expand Up @@ -701,9 +705,8 @@ lldb_private::formatters::
}

template <typename D32, typename D64>
bool
lldb_private::formatters::
GenericNSSetMSyntheticFrontEnd<D32, D64>::Update() {
lldb::ChildCacheState
lldb_private::formatters::GenericNSSetMSyntheticFrontEnd<D32, D64>::Update() {
m_children.clear();
ValueObjectSP valobj_sp = m_backend.GetSP();
m_ptr_size = 0;
Expand All @@ -712,13 +715,13 @@ lldb_private::formatters::
delete m_data_64;
m_data_64 = nullptr;
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;
if (!valobj_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
if (!process_sp)
return false;
return lldb::ChildCacheState::eRefetch;
m_ptr_size = process_sp->GetAddressByteSize();
uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
Status error;
Expand All @@ -731,7 +734,8 @@ lldb_private::formatters::
process_sp->ReadMemory(data_location, m_data_64, sizeof(D64),
error);
}
return error.Success();
return error.Success() ? lldb::ChildCacheState::eReuse
: lldb::ChildCacheState::eRefetch;
}

template <typename D32, typename D64>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
FileSpec dsym_fspec(module_sp->GetSymbolFileFileSpec());

ObjectFileSP dsym_objfile_sp;
if (!dsym_fspec) {
// On Darwin, we store the debug information either in object files,
// using the debug map to tie them to the executable, or in a dSYM. We
// pass through this routine both for binaries and for .o files, but in the
// latter case there will never be an external debug file. So we shouldn't
// do all the stats needed to find it.
if (!dsym_fspec && module_sp->GetObjectFile()->CalculateType() !=
ObjectFile::eTypeObjectFile) {
// No symbol file was specified in the module, lets try and find one
// ourselves.
FileSpec file_spec = obj_file->GetFileSpec();
Expand Down
25 changes: 1 addition & 24 deletions lldb/tools/debugserver/source/RNBRemote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3575,8 +3575,6 @@ rnb_err_t RNBRemote::HandlePacket_qSupported(const char *p) {

if (enable_compression) {
reply << "SupportedCompressions=lzfse,zlib-deflate,lz4,lzma;";
reply << "DefaultCompressionMinSize=" << std::dec << m_compression_minsize
<< ";";
}

#if (defined(__arm64__) || defined(__aarch64__))
Expand Down Expand Up @@ -4482,46 +4480,25 @@ rnb_err_t RNBRemote::HandlePacket_SetEnableAsyncProfiling(const char *p) {
return SendPacket("OK");
}

// QEnableCompression:type:<COMPRESSION-TYPE>;minsize:<MINIMUM PACKET SIZE TO
// COMPRESS>;
// QEnableCompression:type:<COMPRESSION-TYPE>;
//
// type: must be a type previously reported by the qXfer:features:
// SupportedCompressions list
//
// minsize: is optional; by default the qXfer:features:
// DefaultCompressionMinSize value is used
// debugserver may have a better idea of what a good minimum packet size to
// compress is than lldb.

rnb_err_t RNBRemote::HandlePacket_QEnableCompression(const char *p) {
p += sizeof("QEnableCompression:") - 1;

size_t new_compression_minsize = m_compression_minsize;
const char *new_compression_minsize_str = strstr(p, "minsize:");
if (new_compression_minsize_str) {
new_compression_minsize_str += strlen("minsize:");
errno = 0;
new_compression_minsize = strtoul(new_compression_minsize_str, NULL, 10);
if (errno != 0 || new_compression_minsize == ULONG_MAX) {
new_compression_minsize = m_compression_minsize;
}
}

if (strstr(p, "type:zlib-deflate;") != nullptr) {
EnableCompressionNextSendPacket(compression_types::zlib_deflate);
m_compression_minsize = new_compression_minsize;
return SendPacket("OK");
} else if (strstr(p, "type:lz4;") != nullptr) {
EnableCompressionNextSendPacket(compression_types::lz4);
m_compression_minsize = new_compression_minsize;
return SendPacket("OK");
} else if (strstr(p, "type:lzma;") != nullptr) {
EnableCompressionNextSendPacket(compression_types::lzma);
m_compression_minsize = new_compression_minsize;
return SendPacket("OK");
} else if (strstr(p, "type:lzfse;") != nullptr) {
EnableCompressionNextSendPacket(compression_types::lzfse);
m_compression_minsize = new_compression_minsize;
return SendPacket("OK");
}

Expand Down
4 changes: 4 additions & 0 deletions llvm/include/llvm/Analysis/ValueTracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ struct KnownFPClass {
/// definitely set or false if the sign bit is definitely unset.
std::optional<bool> SignBit;

bool operator==(KnownFPClass Other) const {
return KnownFPClasses == Other.KnownFPClasses && SignBit == Other.SignBit;
}

/// Return true if it's known this can never be one of the mask entries.
bool isKnownNever(FPClassTest Mask) const {
return (KnownFPClasses & Mask) == fcNone;
Expand Down
5 changes: 4 additions & 1 deletion llvm/include/llvm/CodeGen/GlobalISel/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,10 @@ LLT getCoverTy(LLT OrigTy, LLT TargetTy);
/// If these are vectors with different element types, this will try to produce
/// a vector with a compatible total size, but the element type of \p OrigTy. If
/// this can't be satisfied, this will produce a scalar smaller than the
/// original vector elements.
/// original vector elements. It is an error to call this function where
/// one argument is a fixed vector and the other is a scalable vector, since it
/// is illegal to build a G_{MERGE|UNMERGE}_VALUES between fixed and scalable
/// vectors.
///
/// In the worst case, this returns LLT::scalar(1)
LLVM_READNONE
Expand Down
4 changes: 1 addition & 3 deletions llvm/include/llvm/CodeGen/MachineFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -1423,9 +1423,7 @@ template <> struct GraphTraits<Inverse<const MachineFunction*>> :
}
};

class MachineFunctionAnalysisManager;
void verifyMachineFunction(MachineFunctionAnalysisManager *,
const std::string &Banner,
void verifyMachineFunction(const std::string &Banner,
const MachineFunction &MF);

} // end namespace llvm
Expand Down
34 changes: 22 additions & 12 deletions llvm/include/llvm/CodeGen/MachineModuleInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,6 @@ class MachineModuleInfo {
unsigned getCurrentCallSite() { return CurCallSite; }

/// \}

// MMI owes MCContext. It should never be invalidated.
bool invalidate(Module &, const PreservedAnalyses &,
ModuleAnalysisManager::Invalidator &) {
return false;
}
}; // End class MachineModuleInfo

class MachineModuleInfoWrapperPass : public ImmutablePass {
Expand All @@ -218,21 +212,37 @@ class MachineModuleInfoWrapperPass : public ImmutablePass {
const MachineModuleInfo &getMMI() const { return MMI; }
};

/// An analysis that produces \c MachineInfo for a module.
/// An analysis that produces \c MachineModuleInfo for a module.
/// This does not produce its own MachineModuleInfo because we need a consistent
/// MachineModuleInfo to keep ownership of MachineFunctions regardless of
/// analysis invalidation/clearing. So something outside the analysis
/// infrastructure must own the MachineModuleInfo.
class MachineModuleAnalysis : public AnalysisInfoMixin<MachineModuleAnalysis> {
friend AnalysisInfoMixin<MachineModuleAnalysis>;
static AnalysisKey Key;

const LLVMTargetMachine *TM;
MachineModuleInfo &MMI;

public:
/// Provide the result type for this analysis pass.
using Result = MachineModuleInfo;
class Result {
MachineModuleInfo &MMI;
Result(MachineModuleInfo &MMI) : MMI(MMI) {}
friend class MachineModuleAnalysis;

public:
MachineModuleInfo &getMMI() { return MMI; }

// MMI owes MCContext. It should never be invalidated.
bool invalidate(Module &, const PreservedAnalyses &,
ModuleAnalysisManager::Invalidator &) {
return false;
}
};

MachineModuleAnalysis(const LLVMTargetMachine *TM) : TM(TM) {}
MachineModuleAnalysis(MachineModuleInfo &MMI) : MMI(MMI) {}

/// Run the analysis pass and produce machine module information.
MachineModuleInfo run(Module &M, ModuleAnalysisManager &);
Result run(Module &M, ModuleAnalysisManager &);
};

} // end namespace llvm
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/Register.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Register {
static_assert(std::numeric_limits<decltype(Reg)>::max() >= 0xFFFFFFFF,
"Reg isn't large enough to hold full range.");

/// isStackSlot - Sometimes it is useful the be able to store a non-negative
/// isStackSlot - Sometimes it is useful to be able to store a non-negative
/// frame index in a variable that normally holds a register. isStackSlot()
/// returns true if Reg is in the range used for stack slots.
///
Expand Down
6 changes: 3 additions & 3 deletions llvm/include/llvm/CodeGen/SelectionDAG.h
Original file line number Diff line number Diff line change
Expand Up @@ -1613,10 +1613,10 @@ class SelectionDAG {
/// Expand the specified \c ISD::VACOPY node as the Legalize pass would.
SDValue expandVACopy(SDNode *Node);

/// Returs an GlobalAddress of the function from the current module with
/// Return a GlobalAddress of the function from the current module with
/// name matching the given ExternalSymbol. Additionally can provide the
/// matched function.
/// Panics the function doesn't exists.
/// Panic if the function doesn't exist.
SDValue getSymbolFunctionGlobalAddress(SDValue Op,
Function **TargetFunction = nullptr);

Expand Down Expand Up @@ -2255,7 +2255,7 @@ class SelectionDAG {
std::pair<EVT, EVT> GetDependentSplitDestVTs(const EVT &VT, const EVT &EnvVT,
bool *HiIsEmpty) const;

/// Split the vector with EXTRACT_SUBVECTOR using the provides
/// Split the vector with EXTRACT_SUBVECTOR using the provided
/// VTs and return the low/high part.
std::pair<SDValue, SDValue> SplitVector(const SDValue &N, const SDLoc &DL,
const EVT &LoVT, const EVT &HiVT);
Expand Down
5 changes: 4 additions & 1 deletion llvm/include/llvm/Frontend/Offloading/OffloadWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ using EntryArrayTy = std::pair<GlobalVariable *, GlobalVariable *>;
/// \param EntryArray Optional pair pointing to the `__start` and `__stop`
/// symbols holding the `__tgt_offload_entry` array.
/// \param Suffix An optional suffix appended to the emitted symbols.
/// \param Relocatable Indicate if we need to change the offloading section to
/// create a relocatable object.
llvm::Error wrapOpenMPBinaries(llvm::Module &M,
llvm::ArrayRef<llvm::ArrayRef<char>> Images,
EntryArrayTy EntryArray,
llvm::StringRef Suffix = "");
llvm::StringRef Suffix = "",
bool Relocatable = false);

/// Wraps the input fatbinary image into the module \p M as global symbols and
/// registers the images with the CUDA runtime.
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/IR/ModuleSummaryIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ class ModuleSummaryIndex {

// Temporary map while building StackIds list. Clear when index is completely
// built via releaseTemporaryMemory.
std::map<uint64_t, unsigned> StackIdToIndex;
DenseMap<uint64_t, unsigned> StackIdToIndex;

// YAML I/O support.
friend yaml::MappingTraits<ModuleSummaryIndex>;
Expand Down
28 changes: 28 additions & 0 deletions llvm/include/llvm/IR/PatternMatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -1711,6 +1711,34 @@ m_BitCast(const OpTy &Op) {
return CastOperator_match<OpTy, Instruction::BitCast>(Op);
}

template <typename Op_t> struct ElementWiseBitCast_match {
Op_t Op;

ElementWiseBitCast_match(const Op_t &OpMatch) : Op(OpMatch) {}

template <typename OpTy> bool match(OpTy *V) {
BitCastInst *I = dyn_cast<BitCastInst>(V);
if (!I)
return false;
Type *SrcType = I->getSrcTy();
Type *DstType = I->getType();
// Make sure the bitcast doesn't change between scalar and vector and
// doesn't change the number of vector elements.
if (SrcType->isVectorTy() != DstType->isVectorTy())
return false;
if (VectorType *SrcVecTy = dyn_cast<VectorType>(SrcType);
SrcVecTy && SrcVecTy->getElementCount() !=
cast<VectorType>(DstType)->getElementCount())
return false;
return Op.match(I->getOperand(0));
}
};

template <typename OpTy>
inline ElementWiseBitCast_match<OpTy> m_ElementWiseBitCast(const OpTy &Op) {
return ElementWiseBitCast_match<OpTy>(Op);
}

/// Matches PtrToInt.
template <typename OpTy>
inline CastOperator_match<OpTy, Instruction::PtrToInt>
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/ProfileData/InstrProf.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ std::string getIRPGOFuncName(const Function &F, bool InLTO = false);

/// \return the filename and the function name parsed from the output of
/// \c getIRPGOFuncName()
std::pair<StringRef, StringRef> getParsedIRPGOFuncName(StringRef IRPGOFuncName);
std::pair<StringRef, StringRef> getParsedIRPGOName(StringRef IRPGOName);

/// Return the name of the global variable used to store a function
/// name in PGO instrumentation. \c FuncName is the IRPGO function name
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Support/AMDGPUMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ constexpr uint32_t VersionMinorV5 = 2;
/// HSA metadata major version for code object V6.
constexpr uint32_t VersionMajorV6 = 1;
/// HSA metadata minor version for code object V6.
constexpr uint32_t VersionMinorV6 = 3;
constexpr uint32_t VersionMinorV6 = 2;

/// Old HSA metadata beginning assembler directive for V2. This is only used for
/// diagnostics now.
Expand Down
21 changes: 21 additions & 0 deletions llvm/lib/Analysis/BasicAliasAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,27 @@ AliasResult BasicAAResult::aliasGEP(
}
}

// VScale Alias Analysis - Given one scalable offset between accesses and a
// scalable typesize, we can divide each side by vscale, treating both values
// as a constant. We prove that Offset/vscale >= TypeSize/vscale.
if (DecompGEP1.VarIndices.size() == 1 && DecompGEP1.VarIndices[0].IsNSW &&
DecompGEP1.VarIndices[0].Val.TruncBits == 0 &&
DecompGEP1.Offset.isZero() &&
PatternMatch::match(DecompGEP1.VarIndices[0].Val.V,
PatternMatch::m_VScale())) {
const VariableGEPIndex &ScalableVar = DecompGEP1.VarIndices[0];
APInt Scale =
ScalableVar.IsNegated ? -ScalableVar.Scale : ScalableVar.Scale;
LocationSize VLeftSize = Scale.isNegative() ? V1Size : V2Size;

// Note that we do not check that the typesize is scalable, as vscale >= 1
// so noalias still holds so long as the dependency distance is at least as
// big as the typesize.
if (VLeftSize.hasValue() &&
Scale.uge(VLeftSize.getValue().getKnownMinValue()))
return AliasResult::NoAlias;
}

// Bail on analysing scalable LocationSize
if (V1Size.isScalable() || V2Size.isScalable())
return AliasResult::MayAlias;
Expand Down
48 changes: 32 additions & 16 deletions llvm/lib/Analysis/DomConditionCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,39 @@ static void findAffectedValues(Value *Cond,
}
};

ICmpInst::Predicate Pred;
Value *A;
if (match(Cond, m_ICmp(Pred, m_Value(A), m_Constant()))) {
AddAffected(A);
bool TopLevelIsAnd = match(Cond, m_LogicalAnd());
SmallVector<Value *, 8> Worklist;
SmallPtrSet<Value *, 8> Visited;
Worklist.push_back(Cond);
while (!Worklist.empty()) {
Value *V = Worklist.pop_back_val();
if (!Visited.insert(V).second)
continue;

if (ICmpInst::isEquality(Pred)) {
Value *X;
// (X & C) or (X | C) or (X ^ C).
// (X << C) or (X >>_s C) or (X >>_u C).
if (match(A, m_BitwiseLogic(m_Value(X), m_ConstantInt())) ||
match(A, m_Shift(m_Value(X), m_ConstantInt())))
AddAffected(X);
} else {
Value *X;
// Handle (A + C1) u< C2, which is the canonical form of A > C3 && A < C4.
if (match(A, m_Add(m_Value(X), m_ConstantInt())))
AddAffected(X);
ICmpInst::Predicate Pred;
Value *A, *B;
// Only recurse into and/or if it matches the top-level and/or type.
if (TopLevelIsAnd ? match(V, m_LogicalAnd(m_Value(A), m_Value(B)))
: match(V, m_LogicalOr(m_Value(A), m_Value(B)))) {
Worklist.push_back(A);
Worklist.push_back(B);
} else if (match(V, m_ICmp(Pred, m_Value(A), m_Constant()))) {
AddAffected(A);

if (ICmpInst::isEquality(Pred)) {
Value *X;
// (X & C) or (X | C) or (X ^ C).
// (X << C) or (X >>_s C) or (X >>_u C).
if (match(A, m_BitwiseLogic(m_Value(X), m_ConstantInt())) ||
match(A, m_Shift(m_Value(X), m_ConstantInt())))
AddAffected(X);
} else {
Value *X;
// Handle (A + C1) u< C2, which is the canonical form of
// A > C3 && A < C4.
if (match(A, m_Add(m_Value(X), m_ConstantInt())))
AddAffected(X);
}
}
}
}
Expand Down
45 changes: 23 additions & 22 deletions llvm/lib/Analysis/InstructionSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1853,35 +1853,36 @@ static Value *simplifyAndOrOfFCmps(const SimplifyQuery &Q, FCmpInst *LHS,
return nullptr;

FCmpInst::Predicate PredL = LHS->getPredicate(), PredR = RHS->getPredicate();
if ((PredL == FCmpInst::FCMP_ORD && PredR == FCmpInst::FCMP_ORD && IsAnd) ||
(PredL == FCmpInst::FCMP_UNO && PredR == FCmpInst::FCMP_UNO && !IsAnd)) {
// (fcmp ord NNAN, X) & (fcmp ord X, Y) --> fcmp ord X, Y
// (fcmp ord NNAN, X) & (fcmp ord Y, X) --> fcmp ord Y, X
// (fcmp ord X, NNAN) & (fcmp ord X, Y) --> fcmp ord X, Y
// (fcmp ord X, NNAN) & (fcmp ord Y, X) --> fcmp ord Y, X
// (fcmp uno NNAN, X) | (fcmp uno X, Y) --> fcmp uno X, Y
// (fcmp uno NNAN, X) | (fcmp uno Y, X) --> fcmp uno Y, X
// (fcmp uno X, NNAN) | (fcmp uno X, Y) --> fcmp uno X, Y
// (fcmp uno X, NNAN) | (fcmp uno Y, X) --> fcmp uno Y, X
if ((PredL == FCmpInst::FCMP_ORD || PredL == FCmpInst::FCMP_UNO) &&
((FCmpInst::isOrdered(PredR) && IsAnd) ||
(FCmpInst::isUnordered(PredR) && !IsAnd))) {
// (fcmp ord X, NNAN) & (fcmp o** X, Y) --> fcmp o** X, Y
// (fcmp uno X, NNAN) & (fcmp o** X, Y) --> false
// (fcmp uno X, NNAN) | (fcmp u** X, Y) --> fcmp u** X, Y
// (fcmp ord X, NNAN) | (fcmp u** X, Y) --> true
if (((LHS1 == RHS0 || LHS1 == RHS1) &&
isKnownNeverNaN(LHS0, /*Depth=*/0, Q)) ||
((LHS0 == RHS0 || LHS0 == RHS1) &&
isKnownNeverNaN(LHS1, /*Depth=*/0, Q)))
return RHS;

// (fcmp ord X, Y) & (fcmp ord NNAN, X) --> fcmp ord X, Y
// (fcmp ord Y, X) & (fcmp ord NNAN, X) --> fcmp ord Y, X
// (fcmp ord X, Y) & (fcmp ord X, NNAN) --> fcmp ord X, Y
// (fcmp ord Y, X) & (fcmp ord X, NNAN) --> fcmp ord Y, X
// (fcmp uno X, Y) | (fcmp uno NNAN, X) --> fcmp uno X, Y
// (fcmp uno Y, X) | (fcmp uno NNAN, X) --> fcmp uno Y, X
// (fcmp uno X, Y) | (fcmp uno X, NNAN) --> fcmp uno X, Y
// (fcmp uno Y, X) | (fcmp uno X, NNAN) --> fcmp uno Y, X
return FCmpInst::isOrdered(PredL) == FCmpInst::isOrdered(PredR)
? static_cast<Value *>(RHS)
: ConstantInt::getBool(LHS->getType(), !IsAnd);
}

if ((PredR == FCmpInst::FCMP_ORD || PredR == FCmpInst::FCMP_UNO) &&
((FCmpInst::isOrdered(PredL) && IsAnd) ||
(FCmpInst::isUnordered(PredL) && !IsAnd))) {
// (fcmp o** X, Y) & (fcmp ord X, NNAN) --> fcmp o** X, Y
// (fcmp o** X, Y) & (fcmp uno X, NNAN) --> false
// (fcmp u** X, Y) | (fcmp uno X, NNAN) --> fcmp u** X, Y
// (fcmp u** X, Y) | (fcmp ord X, NNAN) --> true
if (((RHS1 == LHS0 || RHS1 == LHS1) &&
isKnownNeverNaN(RHS0, /*Depth=*/0, Q)) ||
((RHS0 == LHS0 || RHS0 == LHS1) &&
isKnownNeverNaN(RHS1, /*Depth=*/0, Q)))
return LHS;
return FCmpInst::isOrdered(PredL) == FCmpInst::isOrdered(PredR)
? static_cast<Value *>(LHS)
: ConstantInt::getBool(LHS->getType(), !IsAnd);
}

return nullptr;
Expand Down Expand Up @@ -3034,7 +3035,7 @@ static Value *simplifyICmpWithConstant(CmpInst::Predicate Pred, Value *LHS,
// floating-point casts:
// icmp slt (bitcast (uitofp X)), 0 --> false
// icmp sgt (bitcast (uitofp X)), -1 --> true
if (match(LHS, m_BitCast(m_UIToFP(m_Value(X))))) {
if (match(LHS, m_ElementWiseBitCast(m_UIToFP(m_Value(X))))) {
if (Pred == ICmpInst::ICMP_SLT && match(RHS, m_Zero()))
return ConstantInt::getFalse(ITy);
if (Pred == ICmpInst::ICMP_SGT && match(RHS, m_AllOnes()))
Expand Down
32 changes: 22 additions & 10 deletions llvm/lib/Analysis/ValueTracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,28 +706,40 @@ static void computeKnownBitsFromCmp(const Value *V, CmpInst::Predicate Pred,
}
}

static void computeKnownBitsFromCond(const Value *V, Value *Cond,
KnownBits &Known, unsigned Depth,
const SimplifyQuery &SQ, bool Invert) {
Value *A, *B;
if (Depth < MaxAnalysisRecursionDepth &&
(Invert ? match(Cond, m_LogicalOr(m_Value(A), m_Value(B)))
: match(Cond, m_LogicalAnd(m_Value(A), m_Value(B))))) {
computeKnownBitsFromCond(V, A, Known, Depth + 1, SQ, Invert);
computeKnownBitsFromCond(V, B, Known, Depth + 1, SQ, Invert);
}

if (auto *Cmp = dyn_cast<ICmpInst>(Cond))
computeKnownBitsFromCmp(
V, Invert ? Cmp->getInversePredicate() : Cmp->getPredicate(),
Cmp->getOperand(0), Cmp->getOperand(1), Known, SQ);
}

void llvm::computeKnownBitsFromContext(const Value *V, KnownBits &Known,
unsigned Depth, const SimplifyQuery &Q) {
unsigned Depth, const SimplifyQuery &Q) {
if (!Q.CxtI)
return;

if (Q.DC && Q.DT) {
// Handle dominating conditions.
for (BranchInst *BI : Q.DC->conditionsFor(V)) {
auto *Cmp = dyn_cast<ICmpInst>(BI->getCondition());
if (!Cmp)
continue;

BasicBlockEdge Edge0(BI->getParent(), BI->getSuccessor(0));
if (Q.DT->dominates(Edge0, Q.CxtI->getParent()))
computeKnownBitsFromCmp(V, Cmp->getPredicate(), Cmp->getOperand(0),
Cmp->getOperand(1), Known, Q);
computeKnownBitsFromCond(V, BI->getCondition(), Known, Depth, Q,
/*Invert*/ false);

BasicBlockEdge Edge1(BI->getParent(), BI->getSuccessor(1));
if (Q.DT->dominates(Edge1, Q.CxtI->getParent()))
computeKnownBitsFromCmp(V, Cmp->getInversePredicate(),
Cmp->getOperand(0), Cmp->getOperand(1), Known,
Q);
computeKnownBitsFromCond(V, BI->getCondition(), Known, Depth, Q,
/*Invert*/ true);
}

if (Known.hasConflict())
Expand Down
19 changes: 0 additions & 19 deletions llvm/lib/Bitcode/Reader/BitcodeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6632,9 +6632,6 @@ Error BitcodeReader::materialize(GlobalValue *GV) {
if (Error Err = materializeMetadata())
return Err;

bool NewDebugInfoRequested = F->IsNewDbgInfoFormat;
F->IsNewDbgInfoFormat = false;

// Move the bit stream to the saved position of the deferred function body.
if (Error JumpFailed = Stream.JumpToBit(DFII->second))
return JumpFailed;
Expand Down Expand Up @@ -6710,14 +6707,6 @@ Error BitcodeReader::materialize(GlobalValue *GV) {
// Look for functions that rely on old function attribute behavior.
UpgradeFunctionAttributes(*F);

// If we've materialized a function set up in "new" debug-info mode, the
// contents just loaded will still be in dbg.value mode. Switch to the new
// mode now. NB: we can add more complicated logic here in the future to
// correctly identify when we do and don't need to autoupgrade.
if (NewDebugInfoRequested) {
F->convertToNewDbgValues();
}

// Bring in any functions that this function forward-referenced via
// blockaddresses.
return materializeForwardReferencedFunctions();
Expand Down Expand Up @@ -8042,14 +8031,6 @@ BitcodeModule::getModuleImpl(LLVMContext &Context, bool MaterializeAll,
return std::move(Err);
}

// If we are operating in a "new debug-info" context, upgrade the debug-info
// in the loaded module. This is a transitional approach as we enable "new"
// debug-info in LLVM, which will eventually be pushed down into the
// autoupgrade path once the bitcode-encoding is finalised. Non-materialised
// functions will be upgraded in the materialize method.
if (UseNewDbgInfoFormat && !M->IsNewDbgInfoFormat)
M->convertToNewDbgValues();

return std::move(M);
}

Expand Down
39 changes: 23 additions & 16 deletions llvm/lib/CodeGen/AtomicExpandPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,16 +322,6 @@ bool AtomicExpand::runOnFunction(Function &F) {
if (isIdempotentRMW(RMWI) && simplifyIdempotentRMW(RMWI)) {
MadeChange = true;
} else {
AtomicRMWInst::BinOp Op = RMWI->getOperation();
unsigned MinCASSize = TLI->getMinCmpXchgSizeInBits() / 8;
unsigned ValueSize = getAtomicOpSize(RMWI);
if (ValueSize < MinCASSize &&
(Op == AtomicRMWInst::Or || Op == AtomicRMWInst::Xor ||
Op == AtomicRMWInst::And)) {
RMWI = widenPartwordAtomicRMW(RMWI);
MadeChange = true;
}

MadeChange |= tryExpandAtomicRMW(RMWI);
}
} else if (CASI)
Expand Down Expand Up @@ -607,6 +597,17 @@ bool AtomicExpand::tryExpandAtomicRMW(AtomicRMWInst *AI) {
return true;
}
case TargetLoweringBase::AtomicExpansionKind::MaskedIntrinsic: {
unsigned MinCASSize = TLI->getMinCmpXchgSizeInBits() / 8;
unsigned ValueSize = getAtomicOpSize(AI);
if (ValueSize < MinCASSize) {
AtomicRMWInst::BinOp Op = AI->getOperation();
// Widen And/Or/Xor and give the target another chance at expanding it.
if (Op == AtomicRMWInst::Or || Op == AtomicRMWInst::Xor ||
Op == AtomicRMWInst::And) {
tryExpandAtomicRMW(widenPartwordAtomicRMW(AI));
return true;
}
}
expandAtomicRMWToMaskedIntrinsic(AI);
return true;
}
Expand Down Expand Up @@ -845,6 +846,14 @@ static Value *performMaskedAtomicOp(AtomicRMWInst::BinOp Op,
/// part of the value.
void AtomicExpand::expandPartwordAtomicRMW(
AtomicRMWInst *AI, TargetLoweringBase::AtomicExpansionKind ExpansionKind) {
// Widen And/Or/Xor and give the target another chance at expanding it.
AtomicRMWInst::BinOp Op = AI->getOperation();
if (Op == AtomicRMWInst::Or || Op == AtomicRMWInst::Xor ||
Op == AtomicRMWInst::And) {
tryExpandAtomicRMW(widenPartwordAtomicRMW(AI));
return;
}

AtomicOrdering MemOpOrder = AI->getOrdering();
SyncScope::ID SSID = AI->getSyncScopeID();

Expand All @@ -855,18 +864,16 @@ void AtomicExpand::expandPartwordAtomicRMW(
AI->getAlign(), TLI->getMinCmpXchgSizeInBits() / 8);

Value *ValOperand_Shifted = nullptr;
if (AI->getOperation() == AtomicRMWInst::Xchg ||
AI->getOperation() == AtomicRMWInst::Add ||
AI->getOperation() == AtomicRMWInst::Sub ||
AI->getOperation() == AtomicRMWInst::Nand) {
if (Op == AtomicRMWInst::Xchg || Op == AtomicRMWInst::Add ||
Op == AtomicRMWInst::Sub || Op == AtomicRMWInst::Nand) {
ValOperand_Shifted =
Builder.CreateShl(Builder.CreateZExt(AI->getValOperand(), PMV.WordType),
PMV.ShiftAmt, "ValOperand_Shifted");
}

auto PerformPartwordOp = [&](IRBuilderBase &Builder, Value *Loaded) {
return performMaskedAtomicOp(AI->getOperation(), Builder, Loaded,
ValOperand_Shifted, AI->getValOperand(), PMV);
return performMaskedAtomicOp(Op, Builder, Loaded, ValOperand_Shifted,
AI->getValOperand(), PMV);
};

Value *OldResult;
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/CodeGen/CodeGenPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8455,7 +8455,8 @@ bool CodeGenPrepare::fixupDPValuesOnInst(Instruction &I) {
// FIXME: should updating debug-info really cause the "changed" flag to fire,
// which can cause a function to be reprocessed?
bool CodeGenPrepare::fixupDPValue(DPValue &DPV) {
if (DPV.Type != DPValue::LocationType::Value)
if (DPV.Type != DPValue::LocationType::Value &&
DPV.Type != DPValue::LocationType::Assign)
return false;

// Does this DPValue refer to a sunk address calculation?
Expand Down
7 changes: 7 additions & 0 deletions llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2120,6 +2120,13 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID,
ListSize, Alignment));
return true;
}
case Intrinsic::dbg_assign:
// A dbg.assign is a dbg.value with more information about stack locations,
// typically produced during optimisation of variables with leaked
// addresses. We can treat it like a normal dbg_value intrinsic here; to
// benefit from the full analysis of stack/SSA locations, GlobalISel would
// need to register for and use the AssignmentTrackingAnalysis pass.
LLVM_FALLTHROUGH;
case Intrinsic::dbg_value: {
// This form of DBG_VALUE is target-independent.
const DbgValueInst &DI = cast<DbgValueInst>(CI);
Expand Down
69 changes: 40 additions & 29 deletions llvm/lib/CodeGen/GlobalISel/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,45 +1159,56 @@ LLT llvm::getCoverTy(LLT OrigTy, LLT TargetTy) {
}

LLT llvm::getGCDType(LLT OrigTy, LLT TargetTy) {
const unsigned OrigSize = OrigTy.getSizeInBits();
const unsigned TargetSize = TargetTy.getSizeInBits();

if (OrigSize == TargetSize)
if (OrigTy.getSizeInBits() == TargetTy.getSizeInBits())
return OrigTy;

if (OrigTy.isVector()) {
if (OrigTy.isVector() && TargetTy.isVector()) {
LLT OrigElt = OrigTy.getElementType();
if (TargetTy.isVector()) {
LLT TargetElt = TargetTy.getElementType();
if (OrigElt.getSizeInBits() == TargetElt.getSizeInBits()) {
int GCD = std::gcd(OrigTy.getNumElements(), TargetTy.getNumElements());
return LLT::scalarOrVector(ElementCount::getFixed(GCD), OrigElt);
}
} else {
// If the source is a vector of pointers, return a pointer element.
if (OrigElt.getSizeInBits() == TargetSize)
return OrigElt;
}

unsigned GCD = std::gcd(OrigSize, TargetSize);
// TODO: The docstring for this function says the intention is to use this
// function to build MERGE/UNMERGE instructions. It won't be the case that
// we generate a MERGE/UNMERGE between fixed and scalable vector types. We
// could implement getGCDType between the two in the future if there was a
// need, but it is not worth it now as this function should not be used in
// that way.
assert(((OrigTy.isScalableVector() && !TargetTy.isFixedVector()) ||
(OrigTy.isFixedVector() && !TargetTy.isScalableVector())) &&
"getGCDType not implemented between fixed and scalable vectors.");

unsigned GCD = std::gcd(OrigTy.getSizeInBits().getKnownMinValue(),
TargetTy.getSizeInBits().getKnownMinValue());
if (GCD == OrigElt.getSizeInBits())
return OrigElt;
return LLT::scalarOrVector(ElementCount::get(1, OrigTy.isScalable()),
OrigElt);

// If we can't produce the original element type, we have to use a smaller
// scalar.
// Cannot produce original element type, but both have vscale in common.
if (GCD < OrigElt.getSizeInBits())
return LLT::scalar(GCD);
return LLT::fixed_vector(GCD / OrigElt.getSizeInBits(), OrigElt);
}
return LLT::scalarOrVector(ElementCount::get(1, OrigTy.isScalable()),
GCD);

if (TargetTy.isVector()) {
// Try to preserve the original element type.
LLT TargetElt = TargetTy.getElementType();
if (TargetElt.getSizeInBits() == OrigSize)
return OrigTy;
return LLT::vector(
ElementCount::get(GCD / OrigElt.getSizeInBits().getFixedValue(),
OrigTy.isScalable()),
OrigElt);
}

unsigned GCD = std::gcd(OrigSize, TargetSize);
// If one type is vector and the element size matches the scalar size, then
// the gcd is the scalar type.
if (OrigTy.isVector() &&
OrigTy.getElementType().getSizeInBits() == TargetTy.getSizeInBits())
return OrigTy.getElementType();
if (TargetTy.isVector() &&
TargetTy.getElementType().getSizeInBits() == OrigTy.getSizeInBits())
return OrigTy;

// At this point, both types are either scalars of different type or one is a
// vector and one is a scalar. If both types are scalars, the GCD type is the
// GCD between the two scalar sizes. If one is vector and one is scalar, then
// the GCD type is the GCD between the scalar and the vector element size.
LLT OrigScalar = OrigTy.getScalarType();
LLT TargetScalar = TargetTy.getScalarType();
unsigned GCD = std::gcd(OrigScalar.getSizeInBits().getFixedValue(),
TargetScalar.getSizeInBits().getFixedValue());
return LLT::scalar(GCD);
}

Expand Down
11 changes: 5 additions & 6 deletions llvm/lib/CodeGen/MachineModuleInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,10 @@ bool MachineModuleInfoWrapperPass::doFinalization(Module &M) {

AnalysisKey MachineModuleAnalysis::Key;

MachineModuleInfo MachineModuleAnalysis::run(Module &M,
ModuleAnalysisManager &) {
MachineModuleInfo MMI(TM);
MachineModuleAnalysis::Result
MachineModuleAnalysis::run(Module &M, ModuleAnalysisManager &) {
MMI.TheModule = &M;
MMI.DbgInfoAvailable = !DisableDebugInfoPrinting &&
!M.debug_compile_units().empty();
return MMI;
MMI.DbgInfoAvailable =
!DisableDebugInfoPrinting && !M.debug_compile_units().empty();
return Result(MMI);
}
6 changes: 3 additions & 3 deletions llvm/lib/CodeGen/MachinePassManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Error MachineFunctionPassManager::run(Module &M,
// because we don't run any module pass in codegen pipeline. This is very
// important because the codegen state is stored in MMI which is the analysis
// result of MachineModuleAnalysis. MMI should not be recomputed.
auto &MMI = MFAM.getResult<MachineModuleAnalysis>(M);
auto &MMI = MFAM.getResult<MachineModuleAnalysis>(M).getMMI();

(void)RequireCodeGenSCCOrder;
assert(!RequireCodeGenSCCOrder && "not implemented");
Expand All @@ -42,12 +42,12 @@ Error MachineFunctionPassManager::run(Module &M,
// No need to pop this callback later since MIR pipeline is flat which means
// current pipeline is the top-level pipeline. Callbacks are not used after
// current pipeline.
PI.pushBeforeNonSkippedPassCallback([&MFAM](StringRef PassID, Any IR) {
PI.pushBeforeNonSkippedPassCallback([](StringRef PassID, Any IR) {
assert(llvm::any_cast<const MachineFunction *>(&IR));
const MachineFunction *MF = llvm::any_cast<const MachineFunction *>(IR);
assert(MF && "Machine function should be valid for printing");
std::string Banner = std::string("After ") + std::string(PassID);
verifyMachineFunction(&MFAM, Banner, *MF);
verifyMachineFunction(Banner, *MF);
});
}

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/MachineVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,7 @@ FunctionPass *llvm::createMachineVerifierPass(const std::string &Banner) {
return new MachineVerifierPass(Banner);
}

void llvm::verifyMachineFunction(MachineFunctionAnalysisManager *,
const std::string &Banner,
void llvm::verifyMachineFunction(const std::string &Banner,
const MachineFunction &MF) {
// TODO: Use MFAM after porting below analyses.
// LiveVariables *LiveVars;
Expand Down
76 changes: 34 additions & 42 deletions llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,16 +334,11 @@ namespace {
}

bool SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits) {
TargetLowering::TargetLoweringOpt TLO(DAG, LegalTypes, LegalOperations);
KnownBits Known;
if (!TLI.SimplifyDemandedBits(Op, DemandedBits, Known, TLO, 0, false))
return false;

// Revisit the node.
AddToWorklist(Op.getNode());

CommitTargetLoweringOpt(TLO);
return true;
EVT VT = Op.getValueType();
APInt DemandedElts = VT.isFixedLengthVector()
? APInt::getAllOnes(VT.getVectorNumElements())
: APInt(1, 1);
return SimplifyDemandedBits(Op, DemandedBits, DemandedElts, false);
}

/// Check the specified vector node value to see if it can be simplified or
Expand Down Expand Up @@ -12744,12 +12739,12 @@ static SDValue tryToFoldExtendSelectLoad(SDNode *N, const TargetLowering &TLI,
/// dag nodes (see for example method DAGCombiner::visitSIGN_EXTEND).
/// Vector extends are not folded if operations are legal; this is to
/// avoid introducing illegal build_vector dag nodes.
static SDValue tryToFoldExtendOfConstant(SDNode *N, const TargetLowering &TLI,
static SDValue tryToFoldExtendOfConstant(SDNode *N, const SDLoc &DL,
const TargetLowering &TLI,
SelectionDAG &DAG, bool LegalTypes) {
unsigned Opcode = N->getOpcode();
SDValue N0 = N->getOperand(0);
EVT VT = N->getValueType(0);
SDLoc DL(N);

assert((ISD::isExtOpcode(Opcode) || ISD::isExtVecInRegOpcode(Opcode)) &&
"Expected EXTEND dag node in input!");
Expand Down Expand Up @@ -13405,7 +13400,7 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
if (N0.isUndef())
return DAG.getConstant(0, DL, VT);

if (SDValue Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes))
if (SDValue Res = tryToFoldExtendOfConstant(N, DL, TLI, DAG, LegalTypes))
return Res;

// fold (sext (sext x)) -> (sext x)
Expand Down Expand Up @@ -13674,7 +13669,7 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
if (N0.isUndef())
return DAG.getConstant(0, DL, VT);

if (SDValue Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes))
if (SDValue Res = tryToFoldExtendOfConstant(N, DL, TLI, DAG, LegalTypes))
return Res;

// fold (zext (zext x)) -> (zext x)
Expand Down Expand Up @@ -13942,12 +13937,13 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
SDValue N0 = N->getOperand(0);
EVT VT = N->getValueType(0);
SDLoc DL(N);

// aext(undef) = undef
if (N0.isUndef())
return DAG.getUNDEF(VT);

if (SDValue Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes))
if (SDValue Res = tryToFoldExtendOfConstant(N, DL, TLI, DAG, LegalTypes))
return Res;

// fold (aext (aext x)) -> (aext x)
Expand All @@ -13956,15 +13952,15 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
if (N0.getOpcode() == ISD::ANY_EXTEND ||
N0.getOpcode() == ISD::ZERO_EXTEND ||
N0.getOpcode() == ISD::SIGN_EXTEND)
return DAG.getNode(N0.getOpcode(), SDLoc(N), VT, N0.getOperand(0));
return DAG.getNode(N0.getOpcode(), DL, VT, N0.getOperand(0));

// fold (aext (aext_extend_vector_inreg x)) -> (aext_extend_vector_inreg x)
// fold (aext (zext_extend_vector_inreg x)) -> (zext_extend_vector_inreg x)
// fold (aext (sext_extend_vector_inreg x)) -> (sext_extend_vector_inreg x)
if (N0.getOpcode() == ISD::ANY_EXTEND_VECTOR_INREG ||
N0.getOpcode() == ISD::ZERO_EXTEND_VECTOR_INREG ||
N0.getOpcode() == ISD::SIGN_EXTEND_VECTOR_INREG)
return DAG.getNode(N0.getOpcode(), SDLoc(N), VT, N0.getOperand(0));
return DAG.getNode(N0.getOpcode(), DL, VT, N0.getOperand(0));

// fold (aext (truncate (load x))) -> (aext (smaller load x))
// fold (aext (truncate (srl (load x), c))) -> (aext (small load (x+c/n)))
Expand All @@ -13982,15 +13978,14 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {

// fold (aext (truncate x))
if (N0.getOpcode() == ISD::TRUNCATE)
return DAG.getAnyExtOrTrunc(N0.getOperand(0), SDLoc(N), VT);
return DAG.getAnyExtOrTrunc(N0.getOperand(0), DL, VT);

// Fold (aext (and (trunc x), cst)) -> (and x, cst)
// if the trunc is not free.
if (N0.getOpcode() == ISD::AND &&
N0.getOperand(0).getOpcode() == ISD::TRUNCATE &&
N0.getOperand(1).getOpcode() == ISD::Constant &&
!TLI.isTruncateFree(N0.getOperand(0).getOperand(0), N0.getValueType())) {
SDLoc DL(N);
SDValue X = DAG.getAnyExtOrTrunc(N0.getOperand(0).getOperand(0), DL, VT);
SDValue Y = DAG.getNode(ISD::ANY_EXTEND, DL, VT, N0.getOperand(1));
assert(isa<ConstantSDNode>(Y) && "Expected constant to be folded!");
Expand All @@ -14016,9 +14011,9 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
ExtendUsesToFormExtLoad(VT, N, N0, ISD::ANY_EXTEND, SetCCs, TLI);
if (DoXform) {
LoadSDNode *LN0 = cast<LoadSDNode>(N0);
SDValue ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, SDLoc(N), VT,
LN0->getChain(), LN0->getBasePtr(),
N0.getValueType(), LN0->getMemOperand());
SDValue ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, DL, VT, LN0->getChain(),
LN0->getBasePtr(), N0.getValueType(),
LN0->getMemOperand());
ExtendSetCCUses(SetCCs, N0, ExtLoad, ISD::ANY_EXTEND);
// If the load value is used only by N, replace it via CombineTo N.
bool NoReplaceTrunc = N0.hasOneUse();
Expand All @@ -14044,9 +14039,9 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
ISD::LoadExtType ExtType = LN0->getExtensionType();
EVT MemVT = LN0->getMemoryVT();
if (!LegalOperations || TLI.isLoadExtLegal(ExtType, VT, MemVT)) {
SDValue ExtLoad = DAG.getExtLoad(ExtType, SDLoc(N),
VT, LN0->getChain(), LN0->getBasePtr(),
MemVT, LN0->getMemOperand());
SDValue ExtLoad =
DAG.getExtLoad(ExtType, DL, VT, LN0->getChain(), LN0->getBasePtr(),
MemVT, LN0->getMemOperand());
CombineTo(N, ExtLoad);
DAG.ReplaceAllUsesOfValueWith(SDValue(LN0, 1), ExtLoad.getValue(1));
recursivelyDeleteUnusedNodes(LN0);
Expand Down Expand Up @@ -14074,23 +14069,20 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
// we know that the element size of the sext'd result matches the
// element size of the compare operands.
if (VT.getSizeInBits() == N00VT.getSizeInBits())
return DAG.getSetCC(SDLoc(N), VT, N0.getOperand(0),
N0.getOperand(1),
cast<CondCodeSDNode>(N0.getOperand(2))->get());
return DAG.getSetCC(DL, VT, N0.getOperand(0), N0.getOperand(1),
cast<CondCodeSDNode>(N0.getOperand(2))->get());

// If the desired elements are smaller or larger than the source
// elements we can use a matching integer vector type and then
// truncate/any extend
EVT MatchingVectorType = N00VT.changeVectorElementTypeToInteger();
SDValue VsetCC =
DAG.getSetCC(SDLoc(N), MatchingVectorType, N0.getOperand(0),
N0.getOperand(1),
cast<CondCodeSDNode>(N0.getOperand(2))->get());
return DAG.getAnyExtOrTrunc(VsetCC, SDLoc(N), VT);
SDValue VsetCC = DAG.getSetCC(
DL, MatchingVectorType, N0.getOperand(0), N0.getOperand(1),
cast<CondCodeSDNode>(N0.getOperand(2))->get());
return DAG.getAnyExtOrTrunc(VsetCC, DL, VT);
}

// aext(setcc x,y,cc) -> select_cc x, y, 1, 0, cc
SDLoc DL(N);
if (SDValue SCC = SimplifySelectCC(
DL, N0.getOperand(0), N0.getOperand(1), DAG.getConstant(1, DL, VT),
DAG.getConstant(0, DL, VT),
Expand Down Expand Up @@ -14642,10 +14634,9 @@ SDValue DAGCombiner::visitSIGN_EXTEND_INREG(SDNode *N) {
return SDValue();
}

static SDValue
foldExtendVectorInregToExtendOfSubvector(SDNode *N, const TargetLowering &TLI,
SelectionDAG &DAG,
bool LegalOperations) {
static SDValue foldExtendVectorInregToExtendOfSubvector(
SDNode *N, const SDLoc &DL, const TargetLowering &TLI, SelectionDAG &DAG,
bool LegalOperations) {
unsigned InregOpcode = N->getOpcode();
unsigned Opcode = DAG.getOpcode_EXTEND(InregOpcode);

Expand All @@ -14672,28 +14663,29 @@ foldExtendVectorInregToExtendOfSubvector(SDNode *N, const TargetLowering &TLI,
if (LegalOperations && !TLI.isOperationLegal(Opcode, VT))
return SDValue();

return DAG.getNode(Opcode, SDLoc(N), VT, Src);
return DAG.getNode(Opcode, DL, VT, Src);
}

SDValue DAGCombiner::visitEXTEND_VECTOR_INREG(SDNode *N) {
SDValue N0 = N->getOperand(0);
EVT VT = N->getValueType(0);
SDLoc DL(N);

if (N0.isUndef()) {
// aext_vector_inreg(undef) = undef because the top bits are undefined.
// {s/z}ext_vector_inreg(undef) = 0 because the top bits must be the same.
return N->getOpcode() == ISD::ANY_EXTEND_VECTOR_INREG
? DAG.getUNDEF(VT)
: DAG.getConstant(0, SDLoc(N), VT);
: DAG.getConstant(0, DL, VT);
}

if (SDValue Res = tryToFoldExtendOfConstant(N, TLI, DAG, LegalTypes))
if (SDValue Res = tryToFoldExtendOfConstant(N, DL, TLI, DAG, LegalTypes))
return Res;

if (SimplifyDemandedVectorElts(SDValue(N, 0)))
return SDValue(N, 0);

if (SDValue R = foldExtendVectorInregToExtendOfSubvector(N, TLI, DAG,
if (SDValue R = foldExtendVectorInregToExtendOfSubvector(N, DL, TLI, DAG,
LegalOperations))
return R;

Expand Down
10 changes: 9 additions & 1 deletion llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,8 @@ void FastISel::handleDbgInfo(const Instruction *II) {
V = DPV.getVariableLocationOp(0);

bool Res = false;
if (DPV.getType() == DPValue::LocationType::Value) {
if (DPV.getType() == DPValue::LocationType::Value ||
DPV.getType() == DPValue::LocationType::Assign) {
Res = lowerDbgValue(V, DPV.getExpression(), DPV.getVariable(),
DPV.getDebugLoc());
} else {
Expand Down Expand Up @@ -1393,6 +1394,13 @@ bool FastISel::selectIntrinsicCall(const IntrinsicInst *II) {

return true;
}
case Intrinsic::dbg_assign:
// A dbg.assign is a dbg.value with more information, typically produced
// during optimisation. If one reaches fastisel then something odd has
// happened (such as an optimised function being always-inlined into an
// optnone function). We will not be using the extra information in the
// dbg.assign in that case, just use its dbg.value fields.
LLVM_FALLTHROUGH;
case Intrinsic::dbg_value: {
// This form of DBG_VALUE is target-independent.
const DbgValueInst *DI = cast<DbgValueInst>(II);
Expand Down
18 changes: 10 additions & 8 deletions llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2897,6 +2897,8 @@ void DAGTypeLegalizer::ExpandShiftByConstant(SDNode *N, const APInt &Amt,
/// shift amount.
bool DAGTypeLegalizer::
ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) {
unsigned Opc = N->getOpcode();
SDValue In = N->getOperand(0);
SDValue Amt = N->getOperand(1);
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
EVT ShTy = Amt.getValueType();
Expand All @@ -2907,15 +2909,15 @@ ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) {
SDLoc dl(N);

APInt HighBitMask = APInt::getHighBitsSet(ShBits, ShBits - Log2_32(NVTBits));
KnownBits Known = DAG.computeKnownBits(N->getOperand(1));
KnownBits Known = DAG.computeKnownBits(Amt);

// If we don't know anything about the high bits, exit.
if (((Known.Zero|Known.One) & HighBitMask) == 0)
if (((Known.Zero | Known.One) & HighBitMask) == 0)
return false;

// Get the incoming operand to be shifted.
SDValue InL, InH;
GetExpandedInteger(N->getOperand(0), InL, InH);
GetExpandedInteger(In, InL, InH);

// If we know that any of the high bits of the shift amount are one, then we
// can do this as a couple of simple shifts.
Expand All @@ -2924,7 +2926,7 @@ ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) {
Amt = DAG.getNode(ISD::AND, dl, ShTy, Amt,
DAG.getConstant(~HighBitMask, dl, ShTy));

switch (N->getOpcode()) {
switch (Opc) {
default: llvm_unreachable("Unknown shift");
case ISD::SHL:
Lo = DAG.getConstant(0, dl, NVT); // Low part is zero.
Expand Down Expand Up @@ -2952,15 +2954,15 @@ ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) {
DAG.getConstant(NVTBits - 1, dl, ShTy));

unsigned Op1, Op2;
switch (N->getOpcode()) {
switch (Opc) {
default: llvm_unreachable("Unknown shift");
case ISD::SHL: Op1 = ISD::SHL; Op2 = ISD::SRL; break;
case ISD::SRL:
case ISD::SRA: Op1 = ISD::SRL; Op2 = ISD::SHL; break;
}

// When shifting right the arithmetic for Lo and Hi is swapped.
if (N->getOpcode() != ISD::SHL)
if (Opc != ISD::SHL)
std::swap(InL, InH);

// Use a little trick to get the bits that move from Lo to Hi. First
Expand All @@ -2969,10 +2971,10 @@ ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) {
// Then compute the remaining shift with amount-1.
SDValue Sh2 = DAG.getNode(Op2, dl, NVT, Sh1, Amt2);

Lo = DAG.getNode(N->getOpcode(), dl, NVT, InL, Amt);
Lo = DAG.getNode(Opc, dl, NVT, InL, Amt);
Hi = DAG.getNode(ISD::OR, dl, NVT, DAG.getNode(Op1, dl, NVT, InH, Amt),Sh2);

if (N->getOpcode() != ISD::SHL)
if (Opc != ISD::SHL)
std::swap(Hi, Lo);
return true;
}
Expand Down
Loading