Skip to content

Commit 09a1240

Browse files
author
Valery N Dmitriev
committed
Merge from 'master' to 'sycl-web' (#17)
Fixed build fail after b0eb40c [NFC] Remove unused GetUnderlyingObject paramenter
2 parents 2eb1abc + b0eb40c commit 09a1240

File tree

81 files changed

+639
-310
lines changed

Some content is hidden

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

81 files changed

+639
-310
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ def emit_merged_ifs : Flag<["-"], "emit-merged-ifs">,
712712
HelpText<"Generate Interface Stub Files, emit merged text not binary.">;
713713
def interface_stub_version_EQ : JoinedOrSeparate<["-"], "interface-stub-version=">, Flags<[CC1Option]>;
714714
def exported__symbols__list : Separate<["-"], "exported_symbols_list">;
715-
def e : JoinedOrSeparate<["-"], "e">, Group<Link_Group>;
715+
def e : JoinedOrSeparate<["-"], "e">, Flags<[LinkerInput]>, Group<Link_Group>;
716716
def fmax_tokens_EQ : Joined<["-"], "fmax-tokens=">, Group<f_Group>, Flags<[CC1Option]>,
717717
HelpText<"Max total number of preprocessed tokens for -Wmax-tokens.">;
718718
def fPIC : Flag<["-"], "fPIC">, Group<f_Group>;

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ using tools::addMultilibFlag;
3838
using tools::addPathIfExists;
3939

4040
static bool forwardToGCC(const Option &O) {
41+
// LinkerInput options have been forwarded. Don't duplicate.
42+
if (O.hasFlag(options::LinkerInput))
43+
return false;
4144
return O.matches(options::OPT_Link_Group) || O.hasFlag(options::LinkOption);
4245
}
4346

clang/test/Driver/Xlinker-args.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
/// -T is reordered to the last to make sure -L takes precedence.
1010
// RUN: %clang -target x86_64-pc-linux-gnu -### \
11-
// RUN: -T a.lds -Xlinker one -Xlinker --no-demangle \
11+
// RUN: -e _start -T a.lds -Xlinker one -Xlinker --no-demangle \
1212
// RUN: -Wl,two,--no-demangle,three -Xlinker four -z five -r %s 2> %t
1313
// RUN: FileCheck -check-prefix=LINUX < %t %s
1414
//
1515
// DARWIN-NOT: --no-demangle
1616
// DARWIN: "one" "two" "three" "four" "-z" "five" "-r"
17-
// LINUX: "--no-demangle" "one" "two" "three" "four" "-z" "five" "-r" {{.*}} "-T" "a.lds"
17+
// LINUX: "--no-demangle" "-e" "_start" "one" "two" "three" "four" "-z" "five" "-r" {{.*}} "-T" "a.lds"
1818

1919
// Check that we forward '-Xlinker' and '-Wl,' on Windows.
2020
// RUN: %clang -target i686-pc-win32 -### \

clang/test/Driver/gcc_forward.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clang -### %s -target aarch64-none-elf \
2-
// RUN: --coverage -fuse-ld=lld --ld-path=ld -nostdlib -r -rdynamic -static -static-pie \
2+
// RUN: --coverage -e _start -fuse-ld=lld --ld-path=ld -nostdlib -r -rdynamic -static -static-pie \
33
// RUN: 2>&1 | FileCheck --check-prefix=FORWARD %s
4-
// FORWARD: gcc{{[^"]*}}" "--coverage" "-fuse-ld=lld" "--ld-path=ld" "-nostdlib" "-r" "-rdynamic" "-static" "-static-pie"
4+
// FORWARD: gcc{{[^"]*}}" "--coverage" "-fuse-ld=lld" "--ld-path=ld" "-nostdlib" "-rdynamic" "-static" "-static-pie" "-o" "a.out" "{{.*}}.o" "-e" "_start" "-r"
55

66
// Check that we don't try to forward -Xclang or -mlinker-version to GCC.
77
// PR12920 -- Check also we may not forward W_Group options to GCC.

clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
1717
#include "clang/StaticAnalyzer/Frontend/AnalysisConsumer.h"
1818
#include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h"
19-
#include "llvm/Config/config.h"
19+
#include "llvm/Config/llvm-config.h"
2020
#include "gtest/gtest.h"
2121

2222
// FIXME: Use GTEST_SKIP() instead if GTest is updated to version 1.10.0

flang/lib/Evaluate/fold-complex.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Expr<Type<TypeCategory::Complex, KIND>> FoldIntrinsicFunction(
3636
context, std::move(funcRef), &Scalar<T>::CONJG);
3737
} else if (name == "cmplx") {
3838
using Part = typename T::Part;
39-
if (args.size() == 1) {
39+
if (args.size() == 2) { // CMPLX(X, [KIND])
4040
if (auto *x{UnwrapExpr<Expr<SomeComplex>>(args[0])}) {
4141
return Fold(context, ConvertToType<T>(std::move(*x)));
4242
}
@@ -46,7 +46,8 @@ Expr<Type<TypeCategory::Complex, KIND>> FoldIntrinsicFunction(
4646
Expr<T>{ComplexConstructor<KIND>{ToReal<KIND>(context, std::move(re)),
4747
ToReal<KIND>(context, std::move(im))}});
4848
}
49-
CHECK(args.size() == 2 || args.size() == 3);
49+
// CMPLX(X, [Y, KIND])
50+
CHECK(args.size() == 3);
5051
Expr<SomeType> re{std::move(*args[0].value().UnwrapExpr())};
5152
Expr<SomeType> im{args[1] ? std::move(*args[1].value().UnwrapExpr())
5253
: AsGenericExpr(Constant<Part>{Scalar<Part>{}})};

flang/test/Evaluate/folding01.f90

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ module m
6363
logical, parameter :: test_ne_i1 =.NOT.(2.NE.2)
6464
logical, parameter :: test_ne_i2 = -2.NE.2
6565

66+
! Check conversions
67+
logical, parameter :: test_cmplx1 = cmplx((1._4, -1._4)).EQ.((1._4, -1._4))
68+
logical, parameter :: test_cmplx2 = cmplx((1._4, -1._4), 8).EQ.((1._8, -1._8))
69+
logical, parameter :: test_cmplx3 = cmplx(1._4, -1._4).EQ.((1._4, -1._4))
70+
logical, parameter :: test_cmplx4 = cmplx(1._4, -1._4, 8).EQ.((1._8, -1._8))
71+
logical, parameter :: test_cmplx5 = cmplx(1._4).EQ.((1._4, 0._4))
72+
logical, parameter :: test_cmplx6 = cmplx(1._4, kind=8).EQ.((1._8, 0._8))
73+
6674
! Check integer intrinsic operation folding
6775
logical, parameter :: test_unaryminus_i = (-(-1)).EQ.1
6876
logical, parameter :: test_unaryplus_i = (+1).EQ.1

lld/ELF/Config.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
#include "lld/Common/ErrorHandler.h"
1313
#include "llvm/ADT/MapVector.h"
14-
#include "llvm/ADT/SetVector.h"
1514
#include "llvm/ADT/StringRef.h"
1615
#include "llvm/ADT/StringSet.h"
1716
#include "llvm/BinaryFormat/ELF.h"
@@ -91,13 +90,11 @@ struct Configuration {
9190
uint8_t osabi = 0;
9291
uint32_t andFeatures = 0;
9392
llvm::CachePruningPolicy thinLTOCachePolicy;
94-
llvm::SetVector<StringRef> dependencyFiles; // for --dependency-file
9593
llvm::StringMap<uint64_t> sectionStartMap;
9694
llvm::StringRef bfdname;
9795
llvm::StringRef chroot;
98-
llvm::StringRef dependencyFile;
99-
llvm::StringRef dwoDir;
10096
llvm::StringRef dynamicLinker;
97+
llvm::StringRef dwoDir;
10198
llvm::StringRef entry;
10299
llvm::StringRef emulation;
103100
llvm::StringRef fini;

lld/ELF/Driver.cpp

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,6 @@ static void readConfigs(opt::InputArgList &args) {
918918
config->optimizeBBJumps =
919919
args.hasFlag(OPT_optimize_bb_jumps, OPT_no_optimize_bb_jumps, false);
920920
config->demangle = args.hasFlag(OPT_demangle, OPT_no_demangle, true);
921-
config->dependencyFile = args.getLastArgValue(OPT_dependency_file);
922921
config->dependentLibraries = args.hasFlag(OPT_dependent_libraries, OPT_no_dependent_libraries, true);
923922
config->disableVerify = args.hasArg(OPT_disable_verify);
924923
config->discard = getDiscard(args);
@@ -1565,75 +1564,6 @@ static void handleLibcall(StringRef name) {
15651564
sym->fetch();
15661565
}
15671566

1568-
// Handle --dependency-file=<path>. If that option is given, lld creates a
1569-
// file at a given path with the following contents:
1570-
//
1571-
// <output-file>: <input-file> ...
1572-
//
1573-
// <input-file>:
1574-
//
1575-
// where <output-file> is a pathname of an output file and <input-file>
1576-
// ... is a list of pathnames of all input files. `make` command can read a
1577-
// file in the above format and interpret it as a dependency info. We write
1578-
// phony targets for every <input-file> to avoid an error when that file is
1579-
// removed.
1580-
//
1581-
// This option is useful if you want to make your final executable to depend
1582-
// on all input files including system libraries. Here is why.
1583-
//
1584-
// When you write a Makefile, you usually write it so that the final
1585-
// executable depends on all user-generated object files. Normally, you
1586-
// don't make your executable to depend on system libraries (such as libc)
1587-
// because you don't know the exact paths of libraries, even though system
1588-
// libraries that are linked to your executable statically are technically a
1589-
// part of your program. By using --dependency-file option, you can make
1590-
// lld to dump dependency info so that you can maintain exact dependencies
1591-
// easily.
1592-
static void writeDependencyFile() {
1593-
std::error_code ec;
1594-
raw_fd_ostream os(config->dependencyFile, ec, sys::fs::F_None);
1595-
if (ec) {
1596-
error("cannot open " + config->dependencyFile + ": " + ec.message());
1597-
return;
1598-
}
1599-
1600-
// We use the same escape rules as Clang/GCC which are accepted by Make/Ninja:
1601-
// * A space is escaped by a backslash which itself must be escaped.
1602-
// * A hash sign is escaped by a single backslash.
1603-
// * $ is escapes as $$.
1604-
auto printFilename = [](raw_fd_ostream &os, StringRef filename) {
1605-
llvm::SmallString<256> nativePath;
1606-
llvm::sys::path::native(filename.str(), nativePath);
1607-
llvm::sys::path::remove_dots(nativePath, /*remove_dot_dot=*/true);
1608-
for (unsigned i = 0, e = nativePath.size(); i != e; ++i) {
1609-
if (nativePath[i] == '#') {
1610-
os << '\\';
1611-
} else if (nativePath[i] == ' ') {
1612-
os << '\\';
1613-
unsigned j = i;
1614-
while (j > 0 && nativePath[--j] == '\\')
1615-
os << '\\';
1616-
} else if (nativePath[i] == '$') {
1617-
os << '$';
1618-
}
1619-
os << nativePath[i];
1620-
}
1621-
};
1622-
1623-
os << config->outputFile << ":";
1624-
for (StringRef path : config->dependencyFiles) {
1625-
os << " \\\n ";
1626-
printFilename(os, path);
1627-
}
1628-
os << "\n";
1629-
1630-
for (StringRef path : config->dependencyFiles) {
1631-
os << "\n";
1632-
printFilename(os, path);
1633-
os << ":\n";
1634-
}
1635-
}
1636-
16371567
// Replaces common symbols with defined symbols reside in .bss sections.
16381568
// This function is called after all symbol names are resolved. As a
16391569
// result, the passes after the symbol resolution won't see any
@@ -2134,11 +2064,6 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
21342064
return false;
21352065
});
21362066

2137-
// Since we now have a complete set of input files, we can create
2138-
// a .d file to record build dependencies.
2139-
if (!config->dependencyFile.empty())
2140-
writeDependencyFile();
2141-
21422067
// Now that the number of partitions is fixed, save a pointer to the main
21432068
// partition.
21442069
mainPart = &partitions[0];

lld/ELF/InputFiles.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ Optional<MemoryBufferRef> elf::readFile(StringRef path) {
110110
path = saver.save(config->chroot + path);
111111

112112
log(path);
113-
config->dependencyFiles.insert(path);
114113

115114
auto mbOrErr = MemoryBuffer::getFile(path, -1, false);
116115
if (auto ec = mbOrErr.getError()) {

lld/ELF/Options.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ defm demangle: B<"demangle",
132132
"Demangle symbol names (default)",
133133
"Do not demangle symbol names">;
134134

135-
defm dependency_file: EEq<"dependency-file", "Write a dependency file">,
136-
MetaVarName<"<path>">;
137-
138135
def disable_new_dtags: F<"disable-new-dtags">,
139136
HelpText<"Disable new dynamic tags">;
140137

lld/test/ELF/dependency-file.s

Lines changed: 0 additions & 21 deletions
This file was deleted.

lldb/tools/debugserver/source/debugserver.cpp

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,20 @@ RNBRunLoopMode RNBRunLoopGetStartModeFromRemote(RNBRemote *remote) {
156156
return eRNBRunLoopModeExit;
157157
}
158158

159+
// Check the name to see if it ends with .app
160+
static bool is_dot_app (const char *app_name) {
161+
size_t len = strlen(app_name);
162+
if (len < 4)
163+
return false;
164+
165+
if (app_name[len - 4] == '.' &&
166+
app_name[len - 3] == 'a' &&
167+
app_name[len - 2] == 'p' &&
168+
app_name[len - 1] == 'p')
169+
return true;
170+
return false;
171+
}
172+
159173
// This run loop mode will wait for the process to launch and hit its
160174
// entry point. It will currently ignore all events except for the
161175
// process state changed event, where it watches for the process stopped
@@ -200,17 +214,17 @@ RNBRunLoopMode RNBRunLoopLaunchInferior(RNBRemote *remote,
200214

201215
#if defined WITH_FBS
202216
// Check if we have an app bundle, if so launch using BackBoard Services.
203-
if (strstr(inferior_argv[0], ".app")) {
217+
if (is_dot_app(inferior_argv[0])) {
204218
launch_flavor = eLaunchFlavorFBS;
205219
}
206220
#elif defined WITH_BKS
207221
// Check if we have an app bundle, if so launch using BackBoard Services.
208-
if (strstr(inferior_argv[0], ".app")) {
222+
if (is_dot_app(inferior_argv[0])) {
209223
launch_flavor = eLaunchFlavorBKS;
210224
}
211225
#elif defined WITH_SPRINGBOARD
212226
// Check if we have an app bundle, if so launch using SpringBoard.
213-
if (strstr(inferior_argv[0], ".app")) {
227+
if (is_dot_app(inferior_argv[0])) {
214228
launch_flavor = eLaunchFlavorSpringBoard;
215229
}
216230
#endif
@@ -1499,17 +1513,17 @@ int main(int argc, char *argv[]) {
14991513

15001514
#if defined WITH_FBS
15011515
// Check if we have an app bundle, if so launch using SpringBoard.
1502-
if (waitfor_pid_name.find(".app") != std::string::npos) {
1516+
if (is_dot_app(waitfor_pid_name.c_str())) {
15031517
launch_flavor = eLaunchFlavorFBS;
15041518
}
15051519
#elif defined WITH_BKS
15061520
// Check if we have an app bundle, if so launch using SpringBoard.
1507-
if (waitfor_pid_name.find(".app") != std::string::npos) {
1521+
if (is_dot_app(waitfor_pid_name.c_str())) {
15081522
launch_flavor = eLaunchFlavorBKS;
15091523
}
15101524
#elif defined WITH_SPRINGBOARD
15111525
// Check if we have an app bundle, if so launch using SpringBoard.
1512-
if (waitfor_pid_name.find(".app") != std::string::npos) {
1526+
if (is_dot_app(waitfor_pid_name.c_str())) {
15131527
launch_flavor = eLaunchFlavorSpringBoard;
15141528
}
15151529
#endif

llvm-spirv/lib/SPIRV/OCL20ToSPIRV.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@ void OCL20ToSPIRV::visitCallEnqueueKernel(CallInst *CI,
15311531

15321532
// Invoke: Pointer to invoke function
15331533
Value *BlockFunc = CI->getArgOperand(BlockFIdx);
1534-
Args.push_back(cast<Function>(getUnderlyingObject(BlockFunc, DL)));
1534+
Args.push_back(cast<Function>(getUnderlyingObject(BlockFunc)));
15351535

15361536
// Param: Pointer to block literal
15371537
Value *BlockLiteral = CI->getArgOperand(BlockFIdx + 1);
@@ -1540,7 +1540,7 @@ void OCL20ToSPIRV::visitCallEnqueueKernel(CallInst *CI,
15401540
// Param Size: Size of block literal structure
15411541
// Param Aligment: Aligment of block literal structure
15421542
// TODO: these numbers should be obtained from block literal structure
1543-
Type *ParamType = getUnderlyingObject(BlockLiteral, DL)->getType();
1543+
Type *ParamType = getUnderlyingObject(BlockLiteral)->getType();
15441544
if (PointerType *PT = dyn_cast<PointerType>(ParamType))
15451545
ParamType = PT->getElementType();
15461546
Args.push_back(getInt32(M, DL.getTypeStoreSize(ParamType)));
@@ -1584,13 +1584,13 @@ void OCL20ToSPIRV::visitCallKernelQuery(CallInst *CI, StringRef DemangledName) {
15841584
const unsigned BlockFIdx = HasNDRange ? 1 : 0;
15851585
Value *BlockFVal = CI->getArgOperand(BlockFIdx)->stripPointerCasts();
15861586

1587-
auto *BlockF = cast<Function>(getUnderlyingObject(BlockFVal, DL));
1587+
auto *BlockF = cast<Function>(getUnderlyingObject(BlockFVal));
15881588

15891589
AttributeList Attrs = CI->getCalledFunction()->getAttributes();
15901590
mutateCallInst(M, CI,
15911591
[=](CallInst *CI, std::vector<Value *> &Args) {
15921592
Value *Param = *Args.rbegin();
1593-
Type *ParamType = getUnderlyingObject(Param, DL)->getType();
1593+
Type *ParamType = getUnderlyingObject(Param)->getType();
15941594
if (PointerType *PT = dyn_cast<PointerType>(ParamType)) {
15951595
ParamType = PT->getElementType();
15961596
}

llvm/include/llvm/Analysis/ObjCARCAnalysisUtils.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ inline bool ModuleHasARC(const Module &M) {
6464
/// This is a wrapper around getUnderlyingObject which also knows how to
6565
/// look through objc_retain and objc_autorelease calls, which we know to return
6666
/// their argument verbatim.
67-
inline const Value *GetUnderlyingObjCPtr(const Value *V,
68-
const DataLayout &DL) {
67+
inline const Value *GetUnderlyingObjCPtr(const Value *V) {
6968
for (;;) {
70-
V = getUnderlyingObject(V, DL);
69+
V = getUnderlyingObject(V);
7170
if (!IsForwarding(GetBasicARCInstKind(V)))
7271
break;
7372
V = cast<CallInst>(V)->getArgOperand(0);
@@ -78,12 +77,12 @@ inline const Value *GetUnderlyingObjCPtr(const Value *V,
7877

7978
/// A wrapper for GetUnderlyingObjCPtr used for results memoization.
8079
inline const Value *
81-
GetUnderlyingObjCPtrCached(const Value *V, const DataLayout &DL,
80+
GetUnderlyingObjCPtrCached(const Value *V,
8281
DenseMap<const Value *, WeakTrackingVH> &Cache) {
8382
if (auto InCache = Cache.lookup(V))
8483
return InCache;
8584

86-
const Value *Computed = GetUnderlyingObjCPtr(V, DL);
85+
const Value *Computed = GetUnderlyingObjCPtr(V);
8786
Cache[V] = const_cast<Value *>(Computed);
8887
return Computed;
8988
}

0 commit comments

Comments
 (0)