Skip to content

Commit 8b162df

Browse files
author
Jenkins
committed
merge main into amd-staging
Change-Id: I7abe6690c2044e893bf0a6fb8d657477a572cc6a
2 parents 1d2e39f + 173907b commit 8b162df

File tree

8 files changed

+114
-18
lines changed

8 files changed

+114
-18
lines changed

compiler-rt/test/asan/TestCases/Windows/delay_dbghelp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// static build, there won't be any clang_rt DLLs.
1010
// RUN: not grep cl""ang_rt %t || \
1111
// RUN: grep cl""ang_rt %t | xargs which | \
12-
// RUN: xargs llvm-readobj --coff-imports | not grep dbghelp.dll %t
12+
// RUN: xargs llvm-readobj --coff-imports | not grep dbghelp.dll
1313

1414
extern "C" int puts(const char *);
1515

llvm/include/llvm/Analysis/TargetLibraryInfo.def

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,6 +2162,36 @@ TLI_DEFINE_ENUM_INTERNAL(roundl)
21622162
TLI_DEFINE_STRING_INTERNAL("roundl")
21632163
TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
21642164

2165+
/// double scalbln(double arg, long exp);
2166+
TLI_DEFINE_ENUM_INTERNAL(scalbln)
2167+
TLI_DEFINE_STRING_INTERNAL("scalbln")
2168+
TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl, Long)
2169+
2170+
/// float scalblnf(float arg, long exp);
2171+
TLI_DEFINE_ENUM_INTERNAL(scalblnf)
2172+
TLI_DEFINE_STRING_INTERNAL("scalblnf")
2173+
TLI_DEFINE_SIG_INTERNAL(Flt, Flt, Long)
2174+
2175+
/// long double scalblnl(long double arg, long exp);
2176+
TLI_DEFINE_ENUM_INTERNAL(scalblnl)
2177+
TLI_DEFINE_STRING_INTERNAL("scalblnl")
2178+
TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl, Long)
2179+
2180+
/// double scalbn(double arg, int exp);
2181+
TLI_DEFINE_ENUM_INTERNAL(scalbn)
2182+
TLI_DEFINE_STRING_INTERNAL("scalbn")
2183+
TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl, Int)
2184+
2185+
/// float scalbnf(float arg, int exp);
2186+
TLI_DEFINE_ENUM_INTERNAL(scalbnf)
2187+
TLI_DEFINE_STRING_INTERNAL("scalbnf")
2188+
TLI_DEFINE_SIG_INTERNAL(Flt, Flt, Int)
2189+
2190+
/// long double scalbnl(long double arg, int exp);
2191+
TLI_DEFINE_ENUM_INTERNAL(scalbnl)
2192+
TLI_DEFINE_STRING_INTERNAL("scalbnl")
2193+
TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl, Int)
2194+
21652195
/// int scanf(const char *restrict format, ... );
21662196
TLI_DEFINE_ENUM_INTERNAL(scanf)
21672197
TLI_DEFINE_STRING_INTERNAL("scanf")

llvm/lib/Analysis/TargetLibraryInfo.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,12 @@ static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
382382
TLI.setUnavailable(LibFunc_rintf);
383383
TLI.setUnavailable(LibFunc_round);
384384
TLI.setUnavailable(LibFunc_roundf);
385+
TLI.setUnavailable(LibFunc_scalbln);
386+
TLI.setUnavailable(LibFunc_scalblnf);
387+
TLI.setUnavailable(LibFunc_scalblnl);
388+
TLI.setUnavailable(LibFunc_scalbn);
389+
TLI.setUnavailable(LibFunc_scalbnf);
390+
TLI.setUnavailable(LibFunc_scalbnl);
385391
TLI.setUnavailable(LibFunc_trunc);
386392
TLI.setUnavailable(LibFunc_truncf);
387393
}
@@ -404,6 +410,8 @@ static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
404410
TLI.setUnavailable(LibFunc_nearbyintl);
405411
TLI.setUnavailable(LibFunc_rintl);
406412
TLI.setUnavailable(LibFunc_roundl);
413+
TLI.setUnavailable(LibFunc_scalblnl);
414+
TLI.setUnavailable(LibFunc_scalbnl);
407415
TLI.setUnavailable(LibFunc_truncl);
408416

409417
// Win32 does not support these functions, but

llvm/lib/Transforms/Utils/BuildLibCalls.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,12 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F,
12491249
case LibFunc_round:
12501250
case LibFunc_roundf:
12511251
case LibFunc_roundl:
1252+
case LibFunc_scalbln:
1253+
case LibFunc_scalblnf:
1254+
case LibFunc_scalblnl:
1255+
case LibFunc_scalbn:
1256+
case LibFunc_scalbnf:
1257+
case LibFunc_scalbnl:
12521258
case LibFunc_sin:
12531259
case LibFunc_sincospif_stret:
12541260
case LibFunc_sinf:

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,10 @@ class LoopVectorizationCostModel {
15271527
getReductionPatternCost(Instruction *I, ElementCount VF, Type *VectorTy,
15281528
TTI::TargetCostKind CostKind) const;
15291529

1530+
/// Returns true if \p Op should be considered invariant and if it is
1531+
/// trivially hoistable.
1532+
bool shouldConsiderInvariant(Value *Op);
1533+
15301534
private:
15311535
unsigned NumPredStores = 0;
15321536

@@ -6382,6 +6386,17 @@ void LoopVectorizationCostModel::setVectorizedCallDecision(ElementCount VF) {
63826386
}
63836387
}
63846388

6389+
bool LoopVectorizationCostModel::shouldConsiderInvariant(Value *Op) {
6390+
if (!Legal->isInvariant(Op))
6391+
return false;
6392+
// Consider Op invariant, if it or its operands aren't predicated
6393+
// instruction in the loop. In that case, it is not trivially hoistable.
6394+
return !isa<Instruction>(Op) || !TheLoop->contains(cast<Instruction>(Op)) ||
6395+
(!isPredicatedInst(cast<Instruction>(Op)) &&
6396+
all_of(cast<Instruction>(Op)->operands(),
6397+
[this](Value *Op) { return shouldConsiderInvariant(Op); }));
6398+
}
6399+
63856400
InstructionCost
63866401
LoopVectorizationCostModel::getInstructionCost(Instruction *I,
63876402
ElementCount VF) {
@@ -6621,19 +6636,8 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
66216636
Op2 = cast<SCEVConstant>(PSE.getSCEV(Op2))->getValue();
66226637
}
66236638
auto Op2Info = TTI.getOperandInfo(Op2);
6624-
std::function<bool(Value *)> IsInvariant =
6625-
[this, &IsInvariant](Value *Op) -> bool {
6626-
if (!Legal->isInvariant(Op))
6627-
return false;
6628-
// Consider Op2invariant, if it or its operands aren't predicated
6629-
// instruction in the loop. In that case, it is not trivially hoistable.
6630-
return !isa<Instruction>(Op) ||
6631-
!TheLoop->contains(cast<Instruction>(Op)) ||
6632-
(!isPredicatedInst(cast<Instruction>(Op)) &&
6633-
all_of(cast<Instruction>(Op)->operands(),
6634-
[&IsInvariant](Value *Op) { return IsInvariant(Op); }));
6635-
};
6636-
if (Op2Info.Kind == TargetTransformInfo::OK_AnyValue && IsInvariant(Op2))
6639+
if (Op2Info.Kind == TargetTransformInfo::OK_AnyValue &&
6640+
shouldConsiderInvariant(Op2))
66376641
Op2Info.Kind = TargetTransformInfo::OK_UniformValue;
66386642

66396643
SmallVector<const Value *, 4> Operands(I->operand_values());

llvm/test/Transforms/InferFunctionAttrs/annotate.ll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,24 @@ declare float @roundf(float)
876876
; CHECK: declare x86_fp80 @roundl(x86_fp80) [[NOFREE_NOUNWIND_WILLRETURN_WRITEONLY]]
877877
declare x86_fp80 @roundl(x86_fp80)
878878

879+
; CHECK: declare double @scalbln(double, i64) [[NOFREE_NOUNWIND_WILLRETURN_WRITEONLY]]
880+
declare double @scalbln(double, i64)
881+
882+
; CHECK: declare float @scalblnf(float, i64) [[NOFREE_NOUNWIND_WILLRETURN_WRITEONLY]]
883+
declare float @scalblnf(float, i64)
884+
885+
; CHECK: declare x86_fp80 @scalblnl(x86_fp80, i64) [[NOFREE_NOUNWIND_WILLRETURN_WRITEONLY]]
886+
declare x86_fp80 @scalblnl(x86_fp80, i64)
887+
888+
; CHECK: declare double @scalbn(double, i32) [[NOFREE_NOUNWIND_WILLRETURN_WRITEONLY]]
889+
declare double @scalbn(double, i32)
890+
891+
; CHECK: declare float @scalbnf(float, i32) [[NOFREE_NOUNWIND_WILLRETURN_WRITEONLY]]
892+
declare float @scalbnf(float, i32)
893+
894+
; CHECK: declare x86_fp80 @scalbnl(x86_fp80, i32) [[NOFREE_NOUNWIND_WILLRETURN_WRITEONLY]]
895+
declare x86_fp80 @scalbnl(x86_fp80, i32)
896+
879897
; CHECK: declare noundef i32 @scanf(ptr nocapture noundef readonly, ...) [[NOFREE_NOUNWIND]]
880898
declare i32 @scanf(ptr, ...)
881899

llvm/test/tools/llvm-tli-checker/ps4-tli-check.yaml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#
3535
# CHECK: << Total TLI yes SDK no: 18
3636
# CHECK: >> Total TLI no SDK yes: 0
37-
# CHECK: == Total TLI yes SDK yes: 259
37+
# CHECK: == Total TLI yes SDK yes: 265
3838
#
3939
# WRONG_DETAIL: << TLI yes SDK no : '_ZdaPv' aka operator delete[](void*)
4040
# WRONG_DETAIL: >> TLI no SDK yes: '_ZdaPvj' aka operator delete[](void*, unsigned int)
@@ -48,14 +48,14 @@
4848
# WRONG_DETAIL: << TLI yes SDK no : 'fminimum_numl'
4949
# WRONG_SUMMARY: << Total TLI yes SDK no: 19{{$}}
5050
# WRONG_SUMMARY: >> Total TLI no SDK yes: 1{{$}}
51-
# WRONG_SUMMARY: == Total TLI yes SDK yes: 258
51+
# WRONG_SUMMARY: == Total TLI yes SDK yes: 264
5252
#
5353
## The -COUNT suffix doesn't care if there are too many matches, so check
5454
## the exact count first; the two directives should add up to that.
5555
## Yes, this means additions to TLI will fail this test, but the argument
5656
## to -COUNT can't be an expression.
57-
# AVAIL: TLI knows 510 symbols, 277 available
58-
# AVAIL-COUNT-277: {{^}} available
57+
# AVAIL: TLI knows 516 symbols, 283 available
58+
# AVAIL-COUNT-283: {{^}} available
5959
# AVAIL-NOT: {{^}} available
6060
# UNAVAIL-COUNT-233: not available
6161
# UNAVAIL-NOT: not available
@@ -866,6 +866,30 @@ DynamicSymbols:
866866
Type: STT_FUNC
867867
Section: .text
868868
Binding: STB_GLOBAL
869+
- Name: scalbln
870+
Type: STT_FUNC
871+
Section: .text
872+
Binding: STB_GLOBAL
873+
- Name: scalblnf
874+
Type: STT_FUNC
875+
Section: .text
876+
Binding: STB_GLOBAL
877+
- Name: scalblnl
878+
Type: STT_FUNC
879+
Section: .text
880+
Binding: STB_GLOBAL
881+
- Name: scalbn
882+
Type: STT_FUNC
883+
Section: .text
884+
Binding: STB_GLOBAL
885+
- Name: scalbnf
886+
Type: STT_FUNC
887+
Section: .text
888+
Binding: STB_GLOBAL
889+
- Name: scalbnl
890+
Type: STT_FUNC
891+
Section: .text
892+
Binding: STB_GLOBAL
869893
- Name: scanf
870894
Type: STT_FUNC
871895
Section: .text

llvm/unittests/Analysis/TargetLibraryInfoTest.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,12 @@ TEST_F(TargetLibraryInfoTest, ValidProto) {
335335
"declare double @roundeven(double)\n"
336336
"declare float @roundevenf(float)\n"
337337
"declare x86_fp80 @roundevenl(x86_fp80)\n"
338+
"declare double @scalbln(double, i64)\n"
339+
"declare float @scalblnf(float, i64)\n"
340+
"declare x86_fp80 @scalblnl(x86_fp80, i64)\n"
341+
"declare double @scalbn(double, i32)\n"
342+
"declare float @scalbnf(float, i32)\n"
343+
"declare x86_fp80 @scalbnl(x86_fp80, i32)\n"
338344
"declare i32 @scanf(i8*, ...)\n"
339345
"declare void @setbuf(%struct*, i8*)\n"
340346
"declare i32 @setitimer(i32, %struct*, %struct*)\n"

0 commit comments

Comments
 (0)