Skip to content

Commit 3715110

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-compute-iv-end-values
2 parents 44a0799 + 2067e60 commit 3715110

File tree

10 files changed

+72
-26
lines changed

10 files changed

+72
-26
lines changed

clang-tools-extra/clangd/index/SymbolCollector.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,14 @@ bool SymbolCollector::shouldCollectSymbol(const NamedDecl &ND,
550550
// Avoid indexing internal symbols in protobuf generated headers.
551551
if (isPrivateProtoDecl(ND))
552552
return false;
553+
554+
// System headers that end with `intrin.h` likely contain useful symbols.
553555
if (!Opts.CollectReserved &&
554556
(hasReservedName(ND) || hasReservedScope(*ND.getDeclContext())) &&
555-
ASTCtx.getSourceManager().isInSystemHeader(ND.getLocation()))
557+
ASTCtx.getSourceManager().isInSystemHeader(ND.getLocation()) &&
558+
!ASTCtx.getSourceManager()
559+
.getFilename(ND.getLocation())
560+
.ends_with("intrin.h"))
556561
return false;
557562

558563
return true;

clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,6 +2111,20 @@ TEST_F(SymbolCollectorTest, Reserved) {
21112111
EXPECT_THAT(Symbols, IsEmpty());
21122112
}
21132113

2114+
TEST_F(SymbolCollectorTest, ReservedSymbolInIntrinsicHeader) {
2115+
const char *Header = R"cpp(
2116+
#pragma once
2117+
void __foo();
2118+
)cpp";
2119+
2120+
TestHeaderName = "xintrin.h";
2121+
TestHeaderURI = URI::create(testPath(TestHeaderName)).toString();
2122+
InMemoryFileSystem = new llvm::vfs::InMemoryFileSystem;
2123+
CollectorOpts.FallbackDir = testRoot();
2124+
runSymbolCollector("#pragma GCC system_header\n" + std::string(Header), "");
2125+
EXPECT_THAT(Symbols, UnorderedElementsAre(qName("__foo")));
2126+
}
2127+
21142128
TEST_F(SymbolCollectorTest, Concepts) {
21152129
const char *Header = R"cpp(
21162130
template <class T>

libc/shared/rpc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ namespace rpc {
4444

4545
/// Generic codes that can be used whem implementing the server.
4646
enum Status {
47-
SUCCESS = 0x0,
48-
ERROR = 0x1000,
49-
UNHANDLED_OPCODE = 0x1001,
47+
RPC_SUCCESS = 0x0,
48+
RPC_ERROR = 0x1000,
49+
RPC_UNHANDLED_OPCODE = 0x1001,
5050
};
5151

5252
/// A fixed size channel used to communicate between the RPC client and server.

libc/utils/gpu/loader/Loader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ inline uint32_t handle_server(rpc::Server &server, uint32_t index,
113113
return 0;
114114
index = port->get_index() + 1;
115115

116-
int status = rpc::SUCCESS;
116+
int status = rpc::RPC_SUCCESS;
117117
switch (port->get_opcode()) {
118118
case RPC_TEST_INCREMENT: {
119119
port->recv_and_send([](rpc::Buffer *buffer, uint32_t) {
@@ -186,7 +186,7 @@ inline uint32_t handle_server(rpc::Server &server, uint32_t index,
186186
}
187187

188188
// Handle all of the `libc` specific opcodes.
189-
if (status != rpc::SUCCESS)
189+
if (status != rpc::RPC_SUCCESS)
190190
handle_error("Error handling RPC server");
191191

192192
port->close();

libc/utils/gpu/server/rpc_server.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,10 @@ rpc::Status handle_port_impl(rpc::Server::Port &port) {
437437
break;
438438
}
439439
default:
440-
return rpc::UNHANDLED_OPCODE;
440+
return rpc::RPC_UNHANDLED_OPCODE;
441441
}
442442

443-
return rpc::SUCCESS;
443+
return rpc::RPC_SUCCESS;
444444
}
445445

446446
namespace rpc {
@@ -455,7 +455,7 @@ rpc::Status handle_libc_opcodes(rpc::Server::Port &port, uint32_t num_lanes) {
455455
case 64:
456456
return handle_port_impl<64>(port);
457457
default:
458-
return rpc::ERROR;
458+
return rpc::RPC_ERROR;
459459
}
460460
}
461461
} // namespace rpc

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8381,7 +8381,8 @@ VPHeaderPHIRecipe *VPRecipeBuilder::tryToOptimizeInductionPHI(
83818381
[&](ElementCount VF) {
83828382
return CM.isScalarAfterVectorization(Phi, VF);
83838383
},
8384-
Range));
8384+
Range),
8385+
Phi->getDebugLoc());
83858386
}
83868387
return nullptr;
83878388
}

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,8 +2211,8 @@ class VPWidenPointerInductionRecipe : public VPHeaderPHIRecipe,
22112211
/// Start.
22122212
VPWidenPointerInductionRecipe(PHINode *Phi, VPValue *Start, VPValue *Step,
22132213
const InductionDescriptor &IndDesc,
2214-
bool IsScalarAfterVectorization)
2215-
: VPHeaderPHIRecipe(VPDef::VPWidenPointerInductionSC, Phi),
2214+
bool IsScalarAfterVectorization, DebugLoc DL)
2215+
: VPHeaderPHIRecipe(VPDef::VPWidenPointerInductionSC, Phi, nullptr, DL),
22162216
IndDesc(IndDesc),
22172217
IsScalarAfterVectorization(IsScalarAfterVectorization) {
22182218
addOperand(Start);
@@ -2224,7 +2224,7 @@ class VPWidenPointerInductionRecipe : public VPHeaderPHIRecipe,
22242224
VPWidenPointerInductionRecipe *clone() override {
22252225
return new VPWidenPointerInductionRecipe(
22262226
cast<PHINode>(getUnderlyingInstr()), getOperand(0), getOperand(1),
2227-
IndDesc, IsScalarAfterVectorization);
2227+
IndDesc, IsScalarAfterVectorization, getDebugLoc());
22282228
}
22292229

22302230
VP_CLASSOF_IMPL(VPDef::VPWidenPointerInductionSC)

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3182,6 +3182,7 @@ void VPWidenPointerInductionRecipe::execute(VPTransformState &State) {
31823182
NewPointerPhi = PHINode::Create(ScStValueType, 2, "pointer.phi",
31833183
CanonicalIV->getIterator());
31843184
NewPointerPhi->addIncoming(ScalarStartValue, VectorPH);
3185+
NewPointerPhi->setDebugLoc(getDebugLoc());
31853186
} else {
31863187
// The recipe has been unrolled. In that case, fetch the single pointer phi
31873188
// shared among all unrolled parts of the recipe.
Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
; RUN: opt < %s -passes=loop-vectorize -S 2>&1 | FileCheck %s
2-
; RUN: opt < %s -passes=debugify,loop-vectorize -S | FileCheck %s -check-prefix DEBUGLOC
3-
; RUN: opt < %s -passes=debugify,loop-vectorize -S --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix DEBUGLOC
1+
; RUN: opt < %s -passes=loop-vectorize -force-vector-width=4 -S 2>&1 | FileCheck %s
2+
; RUN: opt < %s -passes=debugify,loop-vectorize -force-vector-width=4 -S | FileCheck %s -check-prefix DEBUGLOC
3+
; RUN: opt < %s -passes=debugify,loop-vectorize -force-vector-width=4 -S --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix DEBUGLOC
44
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
55

66
; This test makes sure we don't duplicate the loop vectorizer's metadata
77
; while marking them as already vectorized (by setting width = 1), even
88
; at lower optimization levels, where no extra cleanup is done
99

10-
; DEBUGLOC-LABEL: define void @_Z3fooPf(
1110
; Check that the phi to resume the scalar part of the loop
1211
; has Debug Location.
1312
define void @_Z3fooPf(ptr %a) {
13+
; DEBUGLOC-LABEL: define void @_Z3fooPf(
14+
; DEBUGLOC: scalar.ph:
15+
; DEBUGLOC-NEXT: %bc.resume.val = phi {{.*}} !dbg ![[RESUMELOC:[0-9]+]]
16+
;
1417
entry:
1518
br label %for.body
1619

@@ -24,16 +27,38 @@ for.body: ; preds = %for.body, %entry
2427
%exitcond = icmp eq i64 %indvars.iv.next, 1024
2528
br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
2629

27-
; DEBUGLOC: scalar.ph:
28-
; DEBUGLOC-NEXT: %bc.resume.val = phi {{.*}} !dbg ![[DbgLoc:[0-9]+]]
30+
for.end: ; preds = %for.body
31+
ret void
32+
}
33+
34+
define void @widen_ptr_induction_dbg(ptr %start, ptr %end) {
35+
; DEBUGLOC-LABEL: define void @widen_ptr_induction_dbg(
36+
; DEBUGLOC: vector.body:
37+
; DEBUGLOC-NEXT: = phi ptr {{.+}}, !dbg ![[PTRIVLOC:[0-9]+]]
38+
; DEBUGLOC: = phi i64
39+
;
40+
; DEBUGLOC: loop:
41+
; DEBUGLOC-NEXT: = phi ptr {{.+}}, !dbg ![[PTRIVLOC]]
2942
;
30-
; DEBUGLOC: ![[DbgLoc]] = !DILocation(line: 2
43+
entry:
44+
br label %loop
3145

32-
for.end: ; preds = %for.body
46+
loop:
47+
%iv = phi ptr [ %start, %entry ], [ %iv.next, %loop ]
48+
%iv.next = getelementptr inbounds ptr, ptr %iv, i64 1
49+
store ptr %iv, ptr %iv, align 1
50+
%cmp.not = icmp eq ptr %iv.next, %end
51+
br i1 %cmp.not, label %exit, label %loop
52+
53+
exit:
3354
ret void
3455
}
3556

57+
3658
!0 = !{!0, !1}
3759
!1 = !{!"llvm.loop.vectorize.width", i32 4}
3860
; CHECK-NOT: !{metadata !"llvm.loop.vectorize.width", i32 4}
3961
; CHECK: !{!"llvm.loop.isvectorized", i32 1}
62+
63+
; DEBUGLOC: ![[RESUMELOC]] = !DILocation(line: 2
64+
; DEBUGLOC: ![[PTRIVLOC]] = !DILocation(line: 12

offload/plugins-nextgen/common/src/RPC.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ rpc::Status handle_offload_opcodes(plugin::GenericDeviceTy &Device,
5656
break;
5757
}
5858
default:
59-
return rpc::UNHANDLED_OPCODE;
59+
return rpc::RPC_UNHANDLED_OPCODE;
6060
break;
6161
}
62-
return rpc::SUCCESS;
62+
return rpc::RPC_SUCCESS;
6363
}
6464

6565
static rpc::Status handle_offload_opcodes(plugin::GenericDeviceTy &Device,
@@ -72,7 +72,7 @@ static rpc::Status handle_offload_opcodes(plugin::GenericDeviceTy &Device,
7272
else if (NumLanes == 64)
7373
return handle_offload_opcodes<64>(Device, Port);
7474
else
75-
return rpc::ERROR;
75+
return rpc::RPC_ERROR;
7676
}
7777

7878
RPCServerTy::RPCServerTy(plugin::GenericPluginTy &Plugin)
@@ -125,12 +125,12 @@ Error RPCServerTy::runServer(plugin::GenericDeviceTy &Device) {
125125

126126
// Let the `libc` library handle any other unhandled opcodes.
127127
#ifdef LIBOMPTARGET_RPC_SUPPORT
128-
if (Status == rpc::UNHANDLED_OPCODE)
128+
if (Status == rpc::RPC_UNHANDLED_OPCODE)
129129
Status = handle_libc_opcodes(*Port, Device.getWarpSize());
130130
#endif
131131

132132
Port->close();
133-
if (Status != rpc::SUCCESS)
133+
if (Status != rpc::RPC_SUCCESS)
134134
return createStringError("RPC server given invalid opcode!");
135135

136136
return Error::success();

0 commit comments

Comments
 (0)