Skip to content

Commit f48edb5

Browse files
author
z1_cciauto
authored
merge main into amd-staging (llvm#2490)
2 parents 9f3b05c + a87dee3 commit f48edb5

File tree

15 files changed

+177
-127
lines changed

15 files changed

+177
-127
lines changed

clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,9 +1858,6 @@ mlir::Value ScalarExprEmitter::VisitUnaryLNot(const UnaryOperator *e) {
18581858

18591859
// ZExt result to the expr type.
18601860
return maybePromoteBoolResult(boolVal, cgf.convertType(e->getType()));
1861-
1862-
cgf.cgm.errorNYI("destination type for logical-not unary operator is NYI");
1863-
return {};
18641861
}
18651862

18661863
/// Return the size or alignment of the type of argument of the sizeof

lldb/source/Commands/CommandObjectProcess.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,7 @@ class CommandObjectProcessSaveCore : public CommandObjectParsed {
13031303
llvm_unreachable("Unimplemented option");
13041304
}
13051305

1306-
return {};
1306+
return error;
13071307
}
13081308

13091309
void OptionParsingStarting(ExecutionContext *execution_context) override {

lldb/source/Symbol/SaveCoreOptions.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Status SaveCoreOptions::SetPluginName(const char *name) {
2424
if (!PluginManager::IsRegisteredObjectFilePluginName(name)) {
2525
return Status::FromErrorStringWithFormat(
2626
"plugin name '%s' is not a valid ObjectFile plugin name", name);
27-
return error;
2827
}
2928

3029
m_plugin_name = name;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This checks that lldb returns an error if process save-core is called
2+
# with a plugin that does not exist.
3+
4+
# RUN: %clang_host -g %S/Inputs/main.c -o %t
5+
# RUN: %lldb %t -s %s -o exit 2>&1 | FileCheck %s
6+
7+
b main
8+
# CHECK-LABEL: b main
9+
# CHECK: Breakpoint 1: where = {{.*}}`main
10+
11+
run
12+
# CHECK-LABEL: run
13+
# CHECK: Process {{.*}} stopped
14+
# CHECK: stop reason = breakpoint 1
15+
# CHECK: frame #0: {{.*}}`main at main.c
16+
17+
process save-core --plugin-name=notaplugin dump
18+
# CHECK-LABEL: process save-core --plugin-name=notaplugin dump
19+
# CHECK: error: plugin name 'notaplugin' is not a valid ObjectFile plugin name

llvm/docs/CommandGuide/lit.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ GENERAL OPTIONS
6363

6464
Show :program:`lit`'s version number and exit.
6565

66-
.. option:: -j N, --workers=N
66+
.. option:: -j N, --workers N
6767

6868
Run ``N`` tests in parallel. By default, this is automatically chosen to
6969
match the number of detected available CPUs.
7070

71-
.. option:: --config-prefix=NAME
71+
.. option:: --config-prefix NAME
7272

7373
Search for :file:`{NAME}.cfg` and :file:`{NAME}.site.cfg` when searching for
7474
test suites, instead of :file:`lit.cfg` and :file:`lit.site.cfg`.
@@ -157,7 +157,7 @@ EXECUTION OPTIONS
157157

158158
Disable sharding for GoogleTest format.
159159

160-
.. option:: --path=PATH
160+
.. option:: --path PATH
161161

162162
Specify an additional ``PATH`` to use when searching for executables in tests.
163163

@@ -178,7 +178,7 @@ EXECUTION OPTIONS
178178
feature that can be used to conditionally disable (or expect failure in)
179179
certain tests.
180180

181-
.. option:: --vg-arg=ARG
181+
.. option:: --vg-arg ARG
182182

183183
When :option:`--vg` is used, specify an additional argument to pass to
184184
:program:`valgrind` itself.
@@ -208,7 +208,7 @@ EXECUTION OPTIONS
208208
Maximum time to spend running a single test (in seconds). 0 means no time
209209
limit. [Default: 0]
210210

211-
.. option:: --timeout=N
211+
.. option:: --timeout N
212212

213213
Spend at most ``N`` seconds (approximately) running each individual test.
214214
``0`` means no time limit, and ``0`` is the default. Note that this is not an
@@ -268,17 +268,17 @@ The timing data is stored in the `test_exec_root` in a file named
268268
`.lit_test_times.txt`. If this file does not exist, then `lit` checks the
269269
`test_source_root` for the file to optionally accelerate clean builds.
270270

271-
.. option:: --max-tests=N
271+
.. option:: --max-tests N
272272

273273
Run at most ``N`` tests and then terminate.
274274

275-
.. option:: --max-time=N
275+
.. option:: --max-time N
276276

277277
Spend at most ``N`` seconds (approximately) running tests and then terminate.
278278
Note that this is not an alias for :option:`--timeout`; the two are
279279
different kinds of maximums.
280280

281-
.. option:: --order={lexical,random,smart}
281+
.. option:: --order {lexical,random,smart}
282282

283283
Define the order in which tests are run. The supported values are:
284284

@@ -300,21 +300,21 @@ The timing data is stored in the `test_exec_root` in a file named
300300

301301
Run failed tests first (DEPRECATED: use ``--order=smart``).
302302

303-
.. option:: --filter=REGEXP
303+
.. option:: --filter REGEXP
304304

305305
Run only those tests whose name matches the regular expression specified in
306306
``REGEXP``. The environment variable ``LIT_FILTER`` can be also used in place
307307
of this option, which is especially useful in environments where the call
308308
to ``lit`` is issued indirectly.
309309

310-
.. option:: --filter-out=REGEXP
310+
.. option:: --filter-out REGEXP
311311

312312
Filter out those tests whose name matches the regular expression specified in
313313
``REGEXP``. The environment variable ``LIT_FILTER_OUT`` can be also used in
314314
place of this option, which is especially useful in environments where the
315315
call to ``lit`` is issued indirectly.
316316

317-
.. option:: --xfail=LIST
317+
.. option:: --xfail LIST
318318

319319
Treat those tests whose name is in the semicolon separated list ``LIST`` as
320320
``XFAIL``. This can be helpful when one does not want to modify the test
@@ -346,7 +346,7 @@ The timing data is stored in the `test_exec_root` in a file named
346346
347347
LIT_XFAIL="affinity/kmp-hw-subset.c;libomptarget :: x86_64-pc-linux-gnu :: offloading/memory_manager.cpp"
348348
349-
.. option:: --xfail-not=LIST
349+
.. option:: --xfail-not LIST
350350

351351
Do not treat the specified tests as ``XFAIL``. The environment variable
352352
``LIT_XFAIL_NOT`` can also be used in place of this option. The syntax is the
@@ -356,7 +356,7 @@ The timing data is stored in the `test_exec_root` in a file named
356356
primary purpose is to suppress an ``XPASS`` result without modifying a test
357357
case that uses the ``XFAIL`` directive.
358358

359-
.. option:: --num-shards=M
359+
.. option:: --num-shards M
360360

361361
Divide the set of selected tests into ``M`` equal-sized subsets or
362362
"shards", and run only one of them. Must be used with the
@@ -366,7 +366,7 @@ The timing data is stored in the `test_exec_root` in a file named
366366
testsuites, for parallel execution on separate machines (say in a large
367367
testing farm).
368368

369-
.. option:: --run-shard=N
369+
.. option:: --run-shard N
370370

371371
Select which shard to run, assuming the ``--num-shards=M`` option was
372372
provided. The two options must be used together, and the value of ``N``

llvm/lib/Analysis/InlineCost.cpp

Lines changed: 43 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,6 @@ class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
263263
// Cache the DataLayout since we use it a lot.
264264
const DataLayout &DL;
265265

266-
DominatorTree DT;
267-
268266
/// The OptimizationRemarkEmitter available for this compilation.
269267
OptimizationRemarkEmitter *ORE;
270268

@@ -1688,66 +1686,51 @@ bool CallAnalyzer::simplifyCmpInstForRecCall(CmpInst &Cmp) {
16881686
if (!isa<Argument>(Cmp.getOperand(0)) || !isa<Constant>(Cmp.getOperand(1)))
16891687
return false;
16901688
auto *CmpOp = Cmp.getOperand(0);
1691-
Function *F = Cmp.getFunction();
1692-
// Iterate over the users of the function to check if it's a recursive
1693-
// function:
1694-
for (auto *U : F->users()) {
1695-
CallInst *Call = dyn_cast<CallInst>(U);
1696-
if (!Call || Call->getFunction() != F || Call->getCalledFunction() != F)
1697-
continue;
1698-
auto *CallBB = Call->getParent();
1699-
auto *Predecessor = CallBB->getSinglePredecessor();
1700-
// Only handle the case when the callsite has a single predecessor:
1701-
if (!Predecessor)
1702-
continue;
1689+
// Make sure that the callsite is recursive:
1690+
if (CandidateCall.getCaller() != &F)
1691+
return false;
1692+
// Only handle the case when the callsite has a single predecessor:
1693+
auto *CallBB = CandidateCall.getParent();
1694+
auto *Predecessor = CallBB->getSinglePredecessor();
1695+
if (!Predecessor)
1696+
return false;
1697+
// Check if the callsite is guarded by the same Cmp instruction:
1698+
auto *Br = dyn_cast<BranchInst>(Predecessor->getTerminator());
1699+
if (!Br || Br->isUnconditional() || Br->getCondition() != &Cmp)
1700+
return false;
17031701

1704-
auto *Br = dyn_cast<BranchInst>(Predecessor->getTerminator());
1705-
if (!Br || Br->isUnconditional())
1706-
continue;
1707-
// Check if the Br condition is the same Cmp instr we are investigating:
1708-
if (Br->getCondition() != &Cmp)
1709-
continue;
1710-
// Check if there are any arg of the recursive callsite is affecting the cmp
1711-
// instr:
1712-
bool ArgFound = false;
1713-
Value *FuncArg = nullptr, *CallArg = nullptr;
1714-
for (unsigned ArgNum = 0;
1715-
ArgNum < F->arg_size() && ArgNum < Call->arg_size(); ArgNum++) {
1716-
FuncArg = F->getArg(ArgNum);
1717-
CallArg = Call->getArgOperand(ArgNum);
1718-
if (FuncArg == CmpOp && CallArg != CmpOp) {
1719-
ArgFound = true;
1720-
break;
1721-
}
1722-
}
1723-
if (!ArgFound)
1724-
continue;
1725-
// Now we have a recursive call that is guarded by a cmp instruction.
1726-
// Check if this cmp can be simplified:
1727-
SimplifyQuery SQ(DL, dyn_cast<Instruction>(CallArg));
1728-
DomConditionCache DC;
1729-
DC.registerBranch(Br);
1730-
SQ.DC = &DC;
1731-
if (DT.root_size() == 0) {
1732-
// Dominator tree was never constructed for any function yet.
1733-
DT.recalculate(*F);
1734-
} else if (DT.getRoot()->getParent() != F) {
1735-
// Dominator tree was constructed for a different function, recalculate
1736-
// it for the current function.
1737-
DT.recalculate(*F);
1702+
// Check if there is any arg of the recursive callsite is affecting the cmp
1703+
// instr:
1704+
bool ArgFound = false;
1705+
Value *FuncArg = nullptr, *CallArg = nullptr;
1706+
for (unsigned ArgNum = 0;
1707+
ArgNum < F.arg_size() && ArgNum < CandidateCall.arg_size(); ArgNum++) {
1708+
FuncArg = F.getArg(ArgNum);
1709+
CallArg = CandidateCall.getArgOperand(ArgNum);
1710+
if (FuncArg == CmpOp && CallArg != CmpOp) {
1711+
ArgFound = true;
1712+
break;
17381713
}
1739-
SQ.DT = &DT;
1740-
Value *SimplifiedInstruction = llvm::simplifyInstructionWithOperands(
1741-
cast<CmpInst>(&Cmp), {CallArg, Cmp.getOperand(1)}, SQ);
1742-
if (auto *ConstVal = dyn_cast_or_null<ConstantInt>(SimplifiedInstruction)) {
1743-
bool IsTrueSuccessor = CallBB == Br->getSuccessor(0);
1744-
// Make sure that the BB of the recursive call is NOT the next successor
1745-
// of the icmp. In other words, make sure that the recursion depth is 1.
1746-
if ((ConstVal->isOne() && !IsTrueSuccessor) ||
1747-
(ConstVal->isZero() && IsTrueSuccessor)) {
1748-
SimplifiedValues[&Cmp] = ConstVal;
1749-
return true;
1750-
}
1714+
}
1715+
if (!ArgFound)
1716+
return false;
1717+
1718+
// Now we have a recursive call that is guarded by a cmp instruction.
1719+
// Check if this cmp can be simplified:
1720+
SimplifyQuery SQ(DL, dyn_cast<Instruction>(CallArg));
1721+
CondContext CC(&Cmp);
1722+
CC.Invert = (CallBB != Br->getSuccessor(0));
1723+
SQ.CC = &CC;
1724+
CC.AffectedValues.insert(FuncArg);
1725+
Value *SimplifiedInstruction = llvm::simplifyInstructionWithOperands(
1726+
cast<CmpInst>(&Cmp), {CallArg, Cmp.getOperand(1)}, SQ);
1727+
if (auto *ConstVal = dyn_cast_or_null<ConstantInt>(SimplifiedInstruction)) {
1728+
// Make sure that the BB of the recursive call is NOT the true successor
1729+
// of the icmp. In other words, make sure that the recursion depth is 1.
1730+
if ((ConstVal->isOne() && CC.Invert) ||
1731+
(ConstVal->isZero() && !CC.Invert)) {
1732+
SimplifiedValues[&Cmp] = ConstVal;
1733+
return true;
17511734
}
17521735
}
17531736
return false;

llvm/lib/CodeGen/GlobalISel/GISelValueTracking.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,6 +1958,31 @@ unsigned GISelValueTracking::computeNumSignBits(Register R,
19581958
}
19591959
break;
19601960
}
1961+
case TargetOpcode::G_CONCAT_VECTORS: {
1962+
if (MRI.getType(MI.getOperand(0).getReg()).isScalableVector())
1963+
break;
1964+
FirstAnswer = TyBits;
1965+
// Determine the minimum number of sign bits across all demanded
1966+
// elts of the input vectors. Early out if the result is already 1.
1967+
unsigned NumSubVectorElts =
1968+
MRI.getType(MI.getOperand(1).getReg()).getNumElements();
1969+
unsigned NumSubVectors = MI.getNumOperands() - 1;
1970+
for (unsigned i = 0; i < NumSubVectors; ++i) {
1971+
APInt DemandedSub =
1972+
DemandedElts.extractBits(NumSubVectorElts, i * NumSubVectorElts);
1973+
if (!DemandedSub)
1974+
continue;
1975+
unsigned Tmp2 = computeNumSignBits(MI.getOperand(i + 1).getReg(),
1976+
DemandedSub, Depth + 1);
1977+
1978+
FirstAnswer = std::min(FirstAnswer, Tmp2);
1979+
1980+
// If we don't know any bits, early out.
1981+
if (FirstAnswer == 1)
1982+
break;
1983+
}
1984+
break;
1985+
}
19611986
case TargetOpcode::G_SHUFFLE_VECTOR: {
19621987
// Collect the minimum number of sign bits that are shared by every vector
19631988
// element referenced by the shuffle.

llvm/test/CodeGen/AArch64/GlobalISel/knownbits-concat.mir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ body: |
4242
; CHECK-NEXT: %1:_ KnownBits:???????? SignBits:1
4343
; CHECK-NEXT: %sext0:_ KnownBits:???????????????? SignBits:9
4444
; CHECK-NEXT: %sext1:_ KnownBits:???????????????? SignBits:9
45-
; CHECK-NEXT: %res:_ KnownBits:???????????????? SignBits:1
45+
; CHECK-NEXT: %res:_ KnownBits:???????????????? SignBits:9
4646
%0:_(<2 x s8>) = COPY $h0
4747
%1:_(<2 x s8>) = COPY $h1
4848
%sext0:_(<2 x s16>) = G_SEXT %0
@@ -60,7 +60,7 @@ body: |
6060
; CHECK-NEXT: %1:_ KnownBits:???????? SignBits:1
6161
; CHECK-NEXT: %zext0:_ KnownBits:00000000???????? SignBits:8
6262
; CHECK-NEXT: %sext1:_ KnownBits:???????????????? SignBits:9
63-
; CHECK-NEXT: %res:_ KnownBits:???????????????? SignBits:1
63+
; CHECK-NEXT: %res:_ KnownBits:???????????????? SignBits:8
6464
%0:_(<2 x s8>) = COPY $h0
6565
%1:_(<2 x s8>) = COPY $h1
6666
%zext0:_(<2 x s16>) = G_ZEXT %0

0 commit comments

Comments
 (0)