Skip to content

Commit 0725ff3

Browse files
committed
Fix case and simplify test file.
1 parent 49b51cf commit 0725ff3

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ bool DevirtModule::tryFindVirtualCallTargets(
10931093
std::vector<VirtualCallTarget> &TargetsForSlot,
10941094
const std::set<TypeMemberInfo> &TypeMemberInfos, uint64_t ByteOffset,
10951095
ModuleSummaryIndex *ExportSummary) {
1096-
bool hasAvailableExternally = false;
1096+
bool HasAvailableExternally = false;
10971097
for (const TypeMemberInfo &TM : TypeMemberInfos) {
10981098
if (!TM.Bits->GV->isConstant())
10991099
return false;
@@ -1106,11 +1106,11 @@ bool DevirtModule::tryFindVirtualCallTargets(
11061106

11071107
// Record if the first GV is AvailableExternally
11081108
if (TargetsForSlot.empty())
1109-
hasAvailableExternally = TM.Bits->GV->hasAvailableExternallyLinkage();
1109+
HasAvailableExternally = TM.Bits->GV->hasAvailableExternallyLinkage();
11101110

11111111
// When the first GV is AvailableExternally, check if all other GVs are
11121112
// also AvailableExternally. If they are not the same, return false.
1113-
if (!TargetsForSlot.empty() && hasAvailableExternally &&
1113+
if (!TargetsForSlot.empty() && HasAvailableExternally &&
11141114
!TM.Bits->GV->hasAvailableExternallyLinkage())
11151115
return false;
11161116

llvm/test/Transforms/WholeProgramDevirt/availableexternal-check.ll

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
; };
99
; long test(std::exception *p) {
1010
; const char* ch = p->what();
11-
; return std::strlen(ch);
11+
; ...;
1212
; }
1313
;
1414
; Build command is "clang++ -O2 -target x86_64-unknown-linux -flto=thin \
@@ -21,8 +21,8 @@
2121
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
2222
target triple = "x86_64-unknown-linux"
2323

24-
@_ZTVSt9exception = available_externally constant { [5 x ptr] } { [5 x ptr] [ptr null, ptr null, ptr null, ptr null, ptr @_ZNKSt9exception4whatEv] }, !type !0, !type !1, !vcall_visibility !2
25-
@_ZTV1A.0 = constant [5 x ptr] [ptr null, ptr null, ptr null, ptr null, ptr @_ZNK1A4whatEv], !type !3, !type !4, !type !5, !type !6, !vcall_visibility !2
24+
@_ZTVSt9exception = available_externally constant { [5 x ptr] } { [5 x ptr] [ptr null, ptr null, ptr null, ptr null, ptr @_ZNKSt9exception4whatEv] }, !type !0, !type !1
25+
@_ZTV1A.0 = constant [5 x ptr] [ptr null, ptr null, ptr null, ptr null, ptr @_ZNK1A4whatEv], !type !3, !type !4, !type !5, !type !6
2626

2727
declare ptr @_ZNKSt9exception4whatEv()
2828

@@ -50,7 +50,6 @@ attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memo
5050

5151
!0 = !{i64 16, !"_ZTSSt9exception"}
5252
!1 = !{i64 32, !"_ZTSMSt9exceptionKDoFPKcvE.virtual"}
53-
!2 = !{i64 1}
5453
!3 = !{i32 16, !"_ZTS1A"}
5554
!4 = !{i32 32, !"_ZTSM1AKDoFPKcvE.virtual"}
5655
!5 = !{i32 16, !"_ZTSSt9exception"}

0 commit comments

Comments
 (0)