diff options
| author | Tim Northover <tnorthover@apple.com> | 2019-06-27 11:44:45 +0000 |
|---|---|---|
| committer | Tim Northover <tnorthover@apple.com> | 2019-06-27 11:44:45 +0000 |
| commit | 22c96a966b111ed433ddab238e9f83109c0a824a (patch) | |
| tree | 0f93e799d95507e27c01e90048f0fc63bdacc08e /llvm/lib/Transforms | |
| parent | cfe9d0fb2bb91ae55136b28b3602e02ddc837d8c (diff) | |
| download | bcm5719-llvm-22c96a966b111ed433ddab238e9f83109c0a824a.tar.gz bcm5719-llvm-22c96a966b111ed433ddab238e9f83109c0a824a.zip | |
IR: compare type attributes deeply when looking into functions.
FunctionComparator attempts to produce a stable comparison of two Function
instances by looking at all available properties. Since ByVal attributes now
contain a Type pointer, they are not trivially ordered and FunctionComparator
should use its own Type comparison logic to sort them.
llvm-svn: 364523
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Utils/FunctionComparator.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/FunctionComparator.cpp b/llvm/lib/Transforms/Utils/FunctionComparator.cpp index 5c400cec573..a9b28754c8e 100644 --- a/llvm/lib/Transforms/Utils/FunctionComparator.cpp +++ b/llvm/lib/Transforms/Utils/FunctionComparator.cpp @@ -113,6 +113,19 @@ int FunctionComparator::cmpAttrs(const AttributeList L, for (; LI != LE && RI != RE; ++LI, ++RI) { Attribute LA = *LI; Attribute RA = *RI; + if (LA.isTypeAttribute() && RA.isTypeAttribute()) { + if (LA.getKindAsEnum() != RA.getKindAsEnum()) + return cmpNumbers(LA.getKindAsEnum(), RA.getKindAsEnum()); + + Type *TyL = LA.getValueAsType(); + Type *TyR = RA.getValueAsType(); + if (TyL && TyR) + return cmpTypes(TyL, TyR); + + // Two pointers, at least one null, so the comparison result is + // independent of the value of a real pointer. + return cmpNumbers((uint64_t)TyL, (uint64_t)TyR); + } if (LA < RA) return -1; if (RA < LA) |

