Skip to content

Commit 0c9925e

Browse files
authored
Merge branch 'main' into fix/148875
2 parents ab541b0 + 871d65b commit 0c9925e

File tree

78 files changed

+2190
-728
lines changed

Some content is hidden

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

78 files changed

+2190
-728
lines changed

.ci/monolithic-linux.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
2121
INSTALL_DIR="${BUILD_DIR}/install"
2222
rm -rf "${BUILD_DIR}"
2323

24-
ccache --zero-stats
24+
sccache --zero-stats
2525

2626
mkdir -p artifacts/reproducers
2727

@@ -31,7 +31,7 @@ export CLANG_CRASH_DIAGNOSTICS_DIR=`realpath artifacts/reproducers`
3131
function at-exit {
3232
retcode=$?
3333

34-
ccache --print-stats > artifacts/ccache_stats.txt
34+
sccache --show-stats > artifacts/sccache_stats.txt
3535
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
3636
cp "${BUILD_DIR}"/test-results.*.xml artifacts/ || :
3737

@@ -73,7 +73,8 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
7373
-D LLVM_LIT_ARGS="${lit_args}" \
7474
-D LLVM_ENABLE_LLD=ON \
7575
-D CMAKE_CXX_FLAGS=-gmlt \
76-
-D LLVM_CCACHE_BUILD=ON \
76+
-D CMAKE_C_COMPILER_LAUNCHER=sccache \
77+
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
7778
-D LIBCXX_CXX_ABI=libcxxabi \
7879
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
7980
-D LLDB_ENABLE_PYTHON=ON \

.github/workflows/premerge.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
- name: Setup ccache
3838
uses: hendrikmuhs/ccache-action@a1209f81afb8c005c13b4296c32e363431bffea5 # v1.2.17
3939
with:
40+
variant: "sccache"
4041
max-size: "2000M"
4142
- name: Build and Test
4243
# Mark the job as a success even if the step fails so that people do

clang-tools-extra/README.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ Clang frontend. These tools are kept in a separate "extra" repository to
88
allow lighter weight checkouts of the core Clang codebase.
99

1010
All discussion regarding Clang, Clang-based tools, and code in this repository
11-
should be held using the standard Clang forum:
11+
should be held using the standard Clang forums:
1212
https://discourse.llvm.org/c/clang
13+
https://discourse.llvm.org/c/clang/clang-tidy/71
14+
https://discourse.llvm.org/c/clang/clangd/34
1315

14-
Code review for this tree should take place on the standard Clang patch and
15-
commit lists:
16-
http://lists.llvm.org/mailman/listinfo/cfe-commits
16+
Code review for this tree should take place on Github:
17+
https://github.com/llvm/llvm-project/pulls?q=label%3Aclang-tools-extra
1718

1819
If you find a bug in these tools, please file it in the LLVM bug tracker:
1920
https://github.com/llvm/llvm-project/issues/

clang/include/clang/Basic/LangOptions.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -633,11 +633,6 @@ class LangOptions : public LangOptionsBase {
633633
// received as a result of a standard operator new (-fcheck-new)
634634
bool CheckNew = false;
635635

636-
// In OpenACC mode, contains a user provided override for the _OPENACC macro.
637-
// This exists so that we can override the macro value and test our incomplete
638-
// implementation on real-world examples.
639-
std::string OpenACCMacroOverride;
640-
641636
/// The HLSL root signature version for dxil.
642637
llvm::dxbc::RootSignatureVersion HLSLRootSigVer =
643638
llvm::dxbc::RootSignatureVersion::V1_1;

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,19 +1422,6 @@ def fno_hip_emit_relocatable : Flag<["-"], "fno-hip-emit-relocatable">,
14221422
HelpText<"Do not override toolchain to compile HIP source to relocatable">;
14231423
}
14241424

1425-
// Clang specific/exclusive options for OpenACC.
1426-
def openacc_macro_override
1427-
: Separate<["-"], "fexperimental-openacc-macro-override">,
1428-
Visibility<[ClangOption, CC1Option]>,
1429-
Group<f_Group>,
1430-
HelpText<"Overrides the _OPENACC macro value for experimental testing "
1431-
"during OpenACC support development">;
1432-
def openacc_macro_override_EQ
1433-
: Joined<["-"], "fexperimental-openacc-macro-override=">,
1434-
Alias<openacc_macro_override>;
1435-
1436-
// End Clang specific/exclusive options for OpenACC.
1437-
14381425
def libomptarget_amdgpu_bc_path_EQ : Joined<["--"], "libomptarget-amdgpu-bc-path=">, Group<i_Group>,
14391426
HelpText<"Path to libomptarget-amdgcn bitcode library">;
14401427
def libomptarget_amdgcn_bc_path_EQ : Joined<["--"], "libomptarget-amdgcn-bc-path=">, Group<i_Group>,

clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
125125
mlir::Value real = emitScalarExpr(e->getArg(0));
126126
mlir::Value imag = emitScalarExpr(e->getArg(1));
127127
mlir::Value complex = builder.createComplexCreate(loc, real, imag);
128-
return RValue::get(complex);
128+
return RValue::getComplex(complex);
129129
}
130130

131131
case Builtin::BI__builtin_creal:
@@ -150,6 +150,18 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
150150
return RValue::get(imag);
151151
}
152152

153+
case Builtin::BI__builtin_conj:
154+
case Builtin::BI__builtin_conjf:
155+
case Builtin::BI__builtin_conjl:
156+
case Builtin::BIconj:
157+
case Builtin::BIconjf:
158+
case Builtin::BIconjl: {
159+
mlir::Value complex = emitComplexExpr(e->getArg(0));
160+
mlir::Value conj = builder.createUnaryOp(getLoc(e->getExprLoc()),
161+
cir::UnaryOpKind::Not, complex);
162+
return RValue::getComplex(conj);
163+
}
164+
153165
case Builtin::BI__builtin_clrsb:
154166
case Builtin::BI__builtin_clrsbl:
155167
case Builtin::BI__builtin_clrsbll:

clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ mlir::Value ComplexExprEmitter::VisitBinComma(const BinaryOperator *e) {
231231
mlir::Value ComplexExprEmitter::VisitCallExpr(const CallExpr *e) {
232232
if (e->getCallReturnType(cgf.getContext())->isReferenceType())
233233
return emitLoadOfLValue(e);
234-
235-
return cgf.emitCallExpr(e).getValue();
234+
return cgf.emitCallExpr(e).getComplexValue();
236235
}
237236

238237
mlir::Value ComplexExprEmitter::VisitCastExpr(CastExpr *e) {

clang/lib/CIR/CodeGen/CIRGenValue.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ class RValue {
5858
return value;
5959
}
6060

61+
/// Return the value of this complex value.
62+
mlir::Value getComplexValue() const {
63+
assert(isComplex() && "Not a complex!");
64+
return value;
65+
}
66+
6167
/// Return the value of the address of the aggregate.
6268
Address getAggregateAddress() const {
6369
assert(isAggregate() && "Not an aggregate!");

clang/lib/CodeGen/Targets/X86.cpp

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,13 +2470,12 @@ GetSSETypeAtOffset(llvm::Type *IRType, unsigned IROffset,
24702470
return llvm::Type::getDoubleTy(getVMContext());
24712471
}
24722472

2473-
24742473
/// GetINTEGERTypeAtOffset - The ABI specifies that a value should be passed in
2475-
/// an 8-byte GPR. This means that we either have a scalar or we are talking
2476-
/// about the high or low part of an up-to-16-byte struct. This routine picks
2477-
/// the best LLVM IR type to represent this, which may be i64 or may be anything
2478-
/// else that the backend will pass in a GPR that works better (e.g. i8, %foo*,
2479-
/// etc).
2474+
/// one or more 8-byte GPRs. This means that we either have a scalar or we are
2475+
/// talking about the high and/or low part of an up-to-16-byte struct. This
2476+
/// routine picks the best LLVM IR type to represent this, which may be i64 or
2477+
/// may be anything else that the backend will pass in GPRs that works better
2478+
/// (e.g. i8, %foo*, etc).
24802479
///
24812480
/// PrefType is an LLVM IR type that corresponds to (part of) the IR type for
24822481
/// the source type. IROffset is an offset in bytes into the LLVM IR type that
@@ -2534,6 +2533,13 @@ GetINTEGERTypeAtOffset(llvm::Type *IRType, unsigned IROffset,
25342533
SourceOffset);
25352534
}
25362535

2536+
// if we have a 128-bit integer, we can pass it safely using an i128
2537+
// so we return that
2538+
if (IRType->isIntegerTy(128)) {
2539+
assert(IROffset == 0);
2540+
return IRType;
2541+
}
2542+
25372543
// Okay, we don't have any better idea of what to pass, so we pass this in an
25382544
// integer register that isn't too big to fit the rest of the struct.
25392545
unsigned TySizeInBytes =
@@ -2591,8 +2597,7 @@ GetX86_64ByValArgumentPair(llvm::Type *Lo, llvm::Type *Hi,
25912597
return Result;
25922598
}
25932599

2594-
ABIArgInfo X86_64ABIInfo::
2595-
classifyReturnType(QualType RetTy) const {
2600+
ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy) const {
25962601
// AMD64-ABI 3.2.3p4: Rule 1. Classify the return type with the
25972602
// classification algorithm.
25982603
X86_64ABIInfo::Class Lo, Hi;
@@ -2638,6 +2643,12 @@ classifyReturnType(QualType RetTy) const {
26382643
isPromotableIntegerTypeForABI(RetTy))
26392644
return ABIArgInfo::getExtend(RetTy);
26402645
}
2646+
2647+
if (ResType->isIntegerTy(128)) {
2648+
// i128 are passed directly
2649+
assert(Hi == Integer);
2650+
return ABIArgInfo::getDirect(ResType);
2651+
}
26412652
break;
26422653

26432654
// AMD64-ABI 3.2.3p4: Rule 4. If the class is SSE, the next
@@ -2783,6 +2794,11 @@ X86_64ABIInfo::classifyArgumentType(QualType Ty, unsigned freeIntRegs,
27832794
return ABIArgInfo::getExtend(Ty, CGT.ConvertType(Ty));
27842795
}
27852796

2797+
if (ResType->isIntegerTy(128)) {
2798+
assert(Hi == Integer);
2799+
++neededInt;
2800+
return ABIArgInfo::getDirect(ResType);
2801+
}
27862802
break;
27872803

27882804
// AMD64-ABI 3.2.3p3: Rule 3. If the class is SSE, the next

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3846,15 +3846,6 @@ static void RenderOpenACCOptions(const Driver &D, const ArgList &Args,
38463846
return;
38473847

38483848
CmdArgs.push_back("-fopenacc");
3849-
3850-
if (Arg *A = Args.getLastArg(options::OPT_openacc_macro_override)) {
3851-
StringRef Value = A->getValue();
3852-
int Version;
3853-
if (!Value.getAsInteger(10, Version))
3854-
A->renderAsInput(Args, CmdArgs);
3855-
else
3856-
D.Diag(diag::err_drv_clang_unsupported) << Value;
3857-
}
38583849
}
38593850

38603851
static void RenderBuiltinOptions(const ToolChain &TC, const llvm::Triple &T,

0 commit comments

Comments
 (0)