Skip to content

Commit d332d76

Browse files
authored
Merge branch 'main' into implicit
2 parents 3c37c40 + 4a8bb08 commit d332d76

File tree

62 files changed

+1465
-304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1465
-304
lines changed

clang/docs/OpenMPSupport.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ and their implementation status. Please post on the
359359
information or if you want to help with the
360360
implementation.
361361

362+
362363
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
363364
|Feature | C/C++ Status | Fortran Status | Reviews |
364365
+=============================================================+===========================+===========================+==========================================================================+
@@ -405,6 +406,7 @@ implementation.
405406
| dispatch construct extension to support end directive | :none:`N/A` | :none:`unclaimed` | |
406407
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
407408

409+
408410
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
409411
|OpenMP 5.2 Deprecations | C/C++ Status | Fortran Status | Reviews |
410412
+=============================================================+===========================+===========================+==========================================================================+
@@ -444,6 +446,7 @@ and their implementation status. Please post on the
444446
information or if you want to help with the
445447
implementation.
446448

449+
447450
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
448451
|Feature | C/C++ Status | Fortran Status | Reviews |
449452
+=============================================================+===========================+===========================+==========================================================================+

clang/lib/Basic/Targets/AMDGPU.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -400,15 +400,12 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
400400
/// in the DWARF.
401401
std::optional<unsigned>
402402
getDWARFAddressSpace(unsigned AddressSpace) const override {
403-
const unsigned DWARF_Private = 1;
404-
const unsigned DWARF_Local = 2;
405-
if (AddressSpace == llvm::AMDGPUAS::PRIVATE_ADDRESS) {
406-
return DWARF_Private;
407-
} else if (AddressSpace == llvm::AMDGPUAS::LOCAL_ADDRESS) {
408-
return DWARF_Local;
409-
} else {
403+
int DWARFAS = llvm::AMDGPU::mapToDWARFAddrSpace(AddressSpace);
404+
// If there is no corresponding address space identifier, or it would be
405+
// the default, then don't emit the attribute.
406+
if (DWARFAS == -1 || DWARFAS == llvm::AMDGPU::DWARFAS::DEFAULT)
410407
return std::nullopt;
411-
}
408+
return DWARFAS;
412409
}
413410

414411
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {

clang/lib/CodeGen/CGHLSLBuiltins.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,12 +604,12 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
604604
Value *OpTrue =
605605
RValTrue.isScalar()
606606
? RValTrue.getScalarVal()
607-
: RValTrue.getAggregatePointer(E->getArg(1)->getType(), *this);
607+
: Builder.CreateLoad(RValTrue.getAggregateAddress(), "true_val");
608608
RValue RValFalse = EmitAnyExpr(E->getArg(2));
609609
Value *OpFalse =
610610
RValFalse.isScalar()
611611
? RValFalse.getScalarVal()
612-
: RValFalse.getAggregatePointer(E->getArg(2)->getType(), *this);
612+
: Builder.CreateLoad(RValFalse.getAggregateAddress(), "false_val");
613613
if (auto *VTy = E->getType()->getAs<VectorType>()) {
614614
if (!OpTrue->getType()->isVectorTy())
615615
OpTrue =

clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ CreateFrontendAction(CompilerInstance &CI) {
210210
}
211211

212212
bool ExecuteCompilerInvocation(CompilerInstance *Clang) {
213+
unsigned NumErrorsBefore = Clang->getDiagnostics().getNumErrors();
214+
213215
// Honor -help.
214216
if (Clang->getFrontendOpts().ShowHelp) {
215217
driver::getDriverOptTable().printHelp(
@@ -292,9 +294,12 @@ bool ExecuteCompilerInvocation(CompilerInstance *Clang) {
292294
}
293295
#endif
294296

295-
// If there were errors in processing arguments, don't do anything else.
296-
if (Clang->getDiagnostics().hasErrorOccurred())
297+
// If there were errors in the above, don't do anything else.
298+
// This intentionally ignores errors emitted before this function to
299+
// accommodate lenient callers that decided to make progress despite errors.
300+
if (Clang->getDiagnostics().getNumErrors() != NumErrorsBefore)
297301
return false;
302+
298303
// Create and execute the frontend action.
299304
std::unique_ptr<FrontendAction> Act(CreateFrontendAction(*Clang));
300305
if (!Act)

clang/test/CodeGenHLSL/builtins/select.hlsl

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,26 @@ int test_select_bool_int(bool cond0, int tVal, int fVal) {
1010
}
1111

1212
struct S { int a; };
13-
// CHECK-LABEL: test_select_infer
14-
// CHECK: [[SELECT:%.*]] = select i1 {{%.*}}, ptr {{%.*}}, ptr {{%.*}}
15-
// CHECK: store ptr [[SELECT]]
13+
// CHECK-LABEL: test_select_infer_struct
14+
// CHECK: [[TRUE_VAL:%.*]] = load %struct.S, ptr {{%.*}}, align 1
15+
// CHECK: [[FALSE_VAL:%.*]] = load %struct.S, ptr {{%.*}}, align 1
16+
// CHECK: [[SELECT:%.*]] = select i1 {{%.*}}, %struct.S [[TRUE_VAL]], %struct.S [[FALSE_VAL]]
17+
// CHECK: store %struct.S [[SELECT]], ptr {{%.*}}, align 1
1618
// CHECK: ret void
17-
struct S test_select_infer(bool cond0, struct S tVal, struct S fVal) {
19+
struct S test_select_infer_struct(bool cond0, struct S tVal, struct S fVal) {
1820
return select(cond0, tVal, fVal);
1921
}
2022

23+
// CHECK-LABEL: test_select_infer_array
24+
// CHECK: [[TRUE_VAL:%.*]] = load [3 x i32], ptr {{%.*}}, align 4
25+
// CHECK: [[FALSE_VAL:%.*]] = load [3 x i32], ptr {{%.*}}, align 4
26+
// CHECK: [[SELECT:%.*]] = select i1 {{%.*}}, [3 x i32] [[TRUE_VAL]], [3 x i32] [[FALSE_VAL]]
27+
// CHECK: store [3 x i32] [[SELECT]], ptr {{%.*}}, align 4
28+
// CHECK: ret void
29+
int test_select_infer_array(bool cond, int tVal[3], int fVal[3])[3] {
30+
return select(cond, tVal, fVal);
31+
}
32+
2133
// CHECK-LABEL: test_select_bool_vector
2234
// CHECK: [[SELECT:%.*]] = select i1 {{%.*}}, <2 x i32> {{%.*}}, <2 x i32> {{%.*}}
2335
// CHECK: ret <2 x i32> [[SELECT]]

0 commit comments

Comments
 (0)