Skip to content

Commit 7c5d8fd

Browse files
Merge from 'main' to 'sycl-web' (5 commits)
CONFLICT (content): Merge conflict in clang/include/clang/Driver/Options.h
2 parents 1b246fb + a73a84c commit 7c5d8fd

File tree

12 files changed

+118
-13
lines changed

12 files changed

+118
-13
lines changed

clang-tools-extra/clangd/CompileCommands.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,8 @@ unsigned char getModes(const llvm::opt::Option &Opt) {
423423
if (!Opt.hasFlag(driver::options::NoDriverOption)) {
424424
if (Opt.hasFlag(driver::options::CLOption)) {
425425
Result |= DM_CL;
426+
} else if (Opt.hasFlag(driver::options::CLDXCOption)) {
427+
Result |= DM_CL;
426428
} else {
427429
Result |= DM_GCC;
428430
if (Opt.hasFlag(driver::options::CoreOption)) {

clang/include/clang/Driver/Options.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ enum ClangFlags {
3636
FC1Option = (1 << 15),
3737
FlangOnlyOption = (1 << 16),
3838
DXCOption = (1 << 17),
39-
Ignored = (1 << 18),
40-
Deprecated = (1 << 19),
39+
CLDXCOption = (1 << 18),
40+
Ignored = (1 << 19),
41+
Deprecated = (1 << 20),
4142
};
4243

4344
enum ID {

clang/include/clang/Driver/Options.td

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ def CC1AsOption : OptionFlag;
5353
// are made available when the driver is running in DXC compatibility mode.
5454
def DXCOption : OptionFlag;
5555

56+
// CLDXCOption - This is a cl.exe/dxc.exe compatibility option. Options with this flag
57+
// are made available when the driver is running in CL/DXC compatibility mode.
58+
def CLDXCOption : OptionFlag;
59+
5660
// NoDriverOption - This option should not be accepted by the driver.
5761
def NoDriverOption : OptionFlag;
5862

@@ -6577,7 +6581,7 @@ def defsym : Separate<["-"], "defsym">,
65776581
// clang-cl Options
65786582
//===----------------------------------------------------------------------===//
65796583

6580-
def cl_Group : OptionGroup<"<clang-cl options>">, Flags<[CLOption]>,
6584+
def cl_Group : OptionGroup<"<clang-cl options>">, Flags<[CLDXCOption]>,
65816585
HelpText<"CL.EXE COMPATIBILITY OPTIONS">;
65826586

65836587
def cl_compile_Group : OptionGroup<"<clang-cl compile-only options>">,
@@ -6607,6 +6611,9 @@ class CLIgnoredJoined<string name> : Option<["/", "-"], name, KIND_JOINED>,
66076611
class CLJoinedOrSeparate<string name> : Option<["/", "-"], name,
66086612
KIND_JOINED_OR_SEPARATE>, Group<cl_Group>, Flags<[CLOption, NoXarchOption]>;
66096613

6614+
class CLDXCJoinedOrSeparate<string name> : Option<["/", "-"], name,
6615+
KIND_JOINED_OR_SEPARATE>, Group<cl_Group>, Flags<[CLDXCOption, NoXarchOption]>;
6616+
66106617
class CLCompileJoinedOrSeparate<string name> : Option<["/", "-"], name,
66116618
KIND_JOINED_OR_SEPARATE>, Group<cl_compile_Group>,
66126619
Flags<[CLOption, NoXarchOption]>;
@@ -6684,7 +6691,7 @@ def _SLASH_help : CLFlag<"help">, Alias<help>,
66846691
def _SLASH_HELP : CLFlag<"HELP">, Alias<help>;
66856692
def _SLASH_hotpatch : CLFlag<"hotpatch">, Alias<fms_hotpatch>,
66866693
HelpText<"Create hotpatchable image">;
6687-
def _SLASH_I : CLJoinedOrSeparate<"I">,
6694+
def _SLASH_I : CLDXCJoinedOrSeparate<"I">,
66886695
HelpText<"Add directory to include search path">, MetaVarName<"<dir>">,
66896696
Alias<I>;
66906697
def _SLASH_J : CLFlag<"J">, HelpText<"Make char type unsigned">,

clang/lib/Driver/Driver.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8883,17 +8883,22 @@ Driver::getIncludeExcludeOptionFlagMasks(bool IsClCompatMode) const {
88838883
if (IsClCompatMode) {
88848884
// Include CL and Core options.
88858885
IncludedFlagsBitmask |= options::CLOption;
8886+
IncludedFlagsBitmask |= options::CLDXCOption;
88868887
IncludedFlagsBitmask |= options::CoreOption;
88878888
} else {
88888889
ExcludedFlagsBitmask |= options::CLOption;
88898890
}
88908891
if (IsDXCMode()) {
88918892
// Include DXC and Core options.
88928893
IncludedFlagsBitmask |= options::DXCOption;
8894+
IncludedFlagsBitmask |= options::CLDXCOption;
88938895
IncludedFlagsBitmask |= options::CoreOption;
88948896
} else {
88958897
ExcludedFlagsBitmask |= options::DXCOption;
88968898
}
8899+
if (!IsClCompatMode && !IsDXCMode())
8900+
ExcludedFlagsBitmask |= options::CLDXCOption;
8901+
88978902
return std::make_pair(IncludedFlagsBitmask, ExcludedFlagsBitmask);
88988903
}
88998904

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3622,6 +3622,7 @@ static void RenderHLSLOptions(const ArgList &Args, ArgStringList &CmdArgs,
36223622
types::ID InputType) {
36233623
const unsigned ForwardedArguments[] = {options::OPT_dxil_validator_version,
36243624
options::OPT_D,
3625+
options::OPT_I,
36253626
options::OPT_S,
36263627
options::OPT_emit_llvm,
36273628
options::OPT_disable_llvm_passes,

clang/test/Driver/dxc_I.hlsl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: %clang_dxc -I test -### %s 2>&1 | FileCheck %s
2+
3+
// Make sure -I send to cc1.
4+
// CHECK:"-I" "test"

llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,13 @@ static bool canEvaluateShifted(Value *V, unsigned NumBits, bool IsLeftShift,
566566
return false;
567567
return true;
568568
}
569+
case Instruction::Mul: {
570+
const APInt *MulConst;
571+
// We can fold (shr (mul X, -(1 << C)), C) -> (and (neg X), C`)
572+
return !IsLeftShift && match(I->getOperand(1), m_APInt(MulConst)) &&
573+
MulConst->isNegatedPowerOf2() &&
574+
MulConst->countTrailingZeros() == NumBits;
575+
}
569576
}
570577
}
571578

@@ -680,6 +687,17 @@ static Value *getShiftedValue(Value *V, unsigned NumBits, bool isLeftShift,
680687
isLeftShift, IC, DL));
681688
return PN;
682689
}
690+
case Instruction::Mul: {
691+
assert(!isLeftShift && "Unexpected shift direction!");
692+
auto *Neg = BinaryOperator::CreateNeg(I->getOperand(0));
693+
IC.InsertNewInstWith(Neg, *I);
694+
unsigned TypeWidth = I->getType()->getScalarSizeInBits();
695+
APInt Mask = APInt::getLowBitsSet(TypeWidth, TypeWidth - NumBits);
696+
auto *And = BinaryOperator::CreateAnd(Neg,
697+
ConstantInt::get(I->getType(), Mask));
698+
And->takeName(I);
699+
return IC.InsertNewInstWith(And, *I);
700+
}
683701
}
684702
}
685703

llvm/test/DebugInfo/Generic/pass-by-value.ll

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
; RUN: | FileCheck %s --check-prefix=STRICT --implicit-check-not DW_AT_calling_convention
44
;
55

6-
; Visibility is unsupported for XCOFF object writing
7-
; XFAIL: -aix
8-
96
; // S is not trivially copyable.
107
; struct S {
118
; ~S() {}

llvm/test/DebugInfo/cross-cu-scope.ll

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s
33
; REQUIRES: object-emission
44

5-
; Visibility is unsupported for XCOFF object writing
6-
; XFAIL: -aix
7-
85
; Reduced test case from PR35212. Two DISubprogram belong to a different CU but
96
; share a scope. Both are declarations and end up in the scope's CU. We want to
107
; check that the CU from the context DIE is used (rather than from the IR).

llvm/test/Transforms/CodeGenPrepare/dead-allocation.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
22
; Eliminate the dead allocation instruction
3+
; REQUIRES: arm-registered-target
34
; RUN: opt -codegenprepare < %s -S | FileCheck %s
45

56
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"

0 commit comments

Comments
 (0)