Skip to content

Commit

Permalink
Merge from 'master' to 'sycl-web' (intel#17)
Browse files Browse the repository at this point in the history
Fixed build fail after b0eb40c [NFC] Remove unused GetUnderlyingObject paramenter
  • Loading branch information
Valery N Dmitriev committed Jul 31, 2020
2 parents 2eb1abc + b0eb40c commit 09a1240
Show file tree
Hide file tree
Showing 81 changed files with 639 additions and 310 deletions.
2 changes: 1 addition & 1 deletion clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ def emit_merged_ifs : Flag<["-"], "emit-merged-ifs">,
HelpText<"Generate Interface Stub Files, emit merged text not binary.">;
def interface_stub_version_EQ : JoinedOrSeparate<["-"], "interface-stub-version=">, Flags<[CC1Option]>;
def exported__symbols__list : Separate<["-"], "exported_symbols_list">;
def e : JoinedOrSeparate<["-"], "e">, Group<Link_Group>;
def e : JoinedOrSeparate<["-"], "e">, Flags<[LinkerInput]>, Group<Link_Group>;
def fmax_tokens_EQ : Joined<["-"], "fmax-tokens=">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Max total number of preprocessed tokens for -Wmax-tokens.">;
def fPIC : Flag<["-"], "fPIC">, Group<f_Group>;
Expand Down
3 changes: 3 additions & 0 deletions clang/lib/Driver/ToolChains/Gnu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ using tools::addMultilibFlag;
using tools::addPathIfExists;

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

Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/Xlinker-args.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

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

// Check that we forward '-Xlinker' and '-Wl,' on Windows.
// RUN: %clang -target i686-pc-win32 -### \
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/gcc_forward.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %clang -### %s -target aarch64-none-elf \
// RUN: --coverage -fuse-ld=lld --ld-path=ld -nostdlib -r -rdynamic -static -static-pie \
// RUN: --coverage -e _start -fuse-ld=lld --ld-path=ld -nostdlib -r -rdynamic -static -static-pie \
// RUN: 2>&1 | FileCheck --check-prefix=FORWARD %s
// FORWARD: gcc{{[^"]*}}" "--coverage" "-fuse-ld=lld" "--ld-path=ld" "-nostdlib" "-r" "-rdynamic" "-static" "-static-pie"
// FORWARD: gcc{{[^"]*}}" "--coverage" "-fuse-ld=lld" "--ld-path=ld" "-nostdlib" "-rdynamic" "-static" "-static-pie" "-o" "a.out" "{{.*}}.o" "-e" "_start" "-r"

// Check that we don't try to forward -Xclang or -mlinker-version to GCC.
// PR12920 -- Check also we may not forward W_Group options to GCC.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Frontend/AnalysisConsumer.h"
#include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h"
#include "llvm/Config/config.h"
#include "llvm/Config/llvm-config.h"
#include "gtest/gtest.h"

// FIXME: Use GTEST_SKIP() instead if GTest is updated to version 1.10.0
Expand Down
5 changes: 3 additions & 2 deletions flang/lib/Evaluate/fold-complex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Expr<Type<TypeCategory::Complex, KIND>> FoldIntrinsicFunction(
context, std::move(funcRef), &Scalar<T>::CONJG);
} else if (name == "cmplx") {
using Part = typename T::Part;
if (args.size() == 1) {
if (args.size() == 2) { // CMPLX(X, [KIND])
if (auto *x{UnwrapExpr<Expr<SomeComplex>>(args[0])}) {
return Fold(context, ConvertToType<T>(std::move(*x)));
}
Expand All @@ -46,7 +46,8 @@ Expr<Type<TypeCategory::Complex, KIND>> FoldIntrinsicFunction(
Expr<T>{ComplexConstructor<KIND>{ToReal<KIND>(context, std::move(re)),
ToReal<KIND>(context, std::move(im))}});
}
CHECK(args.size() == 2 || args.size() == 3);
// CMPLX(X, [Y, KIND])
CHECK(args.size() == 3);
Expr<SomeType> re{std::move(*args[0].value().UnwrapExpr())};
Expr<SomeType> im{args[1] ? std::move(*args[1].value().UnwrapExpr())
: AsGenericExpr(Constant<Part>{Scalar<Part>{}})};
Expand Down
8 changes: 8 additions & 0 deletions flang/test/Evaluate/folding01.f90
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ module m
logical, parameter :: test_ne_i1 =.NOT.(2.NE.2)
logical, parameter :: test_ne_i2 = -2.NE.2

! Check conversions
logical, parameter :: test_cmplx1 = cmplx((1._4, -1._4)).EQ.((1._4, -1._4))
logical, parameter :: test_cmplx2 = cmplx((1._4, -1._4), 8).EQ.((1._8, -1._8))
logical, parameter :: test_cmplx3 = cmplx(1._4, -1._4).EQ.((1._4, -1._4))
logical, parameter :: test_cmplx4 = cmplx(1._4, -1._4, 8).EQ.((1._8, -1._8))
logical, parameter :: test_cmplx5 = cmplx(1._4).EQ.((1._4, 0._4))
logical, parameter :: test_cmplx6 = cmplx(1._4, kind=8).EQ.((1._8, 0._8))

! Check integer intrinsic operation folding
logical, parameter :: test_unaryminus_i = (-(-1)).EQ.1
logical, parameter :: test_unaryplus_i = (+1).EQ.1
Expand Down
5 changes: 1 addition & 4 deletions lld/ELF/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include "lld/Common/ErrorHandler.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/BinaryFormat/ELF.h"
Expand Down Expand Up @@ -91,13 +90,11 @@ struct Configuration {
uint8_t osabi = 0;
uint32_t andFeatures = 0;
llvm::CachePruningPolicy thinLTOCachePolicy;
llvm::SetVector<StringRef> dependencyFiles; // for --dependency-file
llvm::StringMap<uint64_t> sectionStartMap;
llvm::StringRef bfdname;
llvm::StringRef chroot;
llvm::StringRef dependencyFile;
llvm::StringRef dwoDir;
llvm::StringRef dynamicLinker;
llvm::StringRef dwoDir;
llvm::StringRef entry;
llvm::StringRef emulation;
llvm::StringRef fini;
Expand Down
75 changes: 0 additions & 75 deletions lld/ELF/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,6 @@ static void readConfigs(opt::InputArgList &args) {
config->optimizeBBJumps =
args.hasFlag(OPT_optimize_bb_jumps, OPT_no_optimize_bb_jumps, false);
config->demangle = args.hasFlag(OPT_demangle, OPT_no_demangle, true);
config->dependencyFile = args.getLastArgValue(OPT_dependency_file);
config->dependentLibraries = args.hasFlag(OPT_dependent_libraries, OPT_no_dependent_libraries, true);
config->disableVerify = args.hasArg(OPT_disable_verify);
config->discard = getDiscard(args);
Expand Down Expand Up @@ -1565,75 +1564,6 @@ static void handleLibcall(StringRef name) {
sym->fetch();
}

// Handle --dependency-file=<path>. If that option is given, lld creates a
// file at a given path with the following contents:
//
// <output-file>: <input-file> ...
//
// <input-file>:
//
// where <output-file> is a pathname of an output file and <input-file>
// ... is a list of pathnames of all input files. `make` command can read a
// file in the above format and interpret it as a dependency info. We write
// phony targets for every <input-file> to avoid an error when that file is
// removed.
//
// This option is useful if you want to make your final executable to depend
// on all input files including system libraries. Here is why.
//
// When you write a Makefile, you usually write it so that the final
// executable depends on all user-generated object files. Normally, you
// don't make your executable to depend on system libraries (such as libc)
// because you don't know the exact paths of libraries, even though system
// libraries that are linked to your executable statically are technically a
// part of your program. By using --dependency-file option, you can make
// lld to dump dependency info so that you can maintain exact dependencies
// easily.
static void writeDependencyFile() {
std::error_code ec;
raw_fd_ostream os(config->dependencyFile, ec, sys::fs::F_None);
if (ec) {
error("cannot open " + config->dependencyFile + ": " + ec.message());
return;
}

// We use the same escape rules as Clang/GCC which are accepted by Make/Ninja:
// * A space is escaped by a backslash which itself must be escaped.
// * A hash sign is escaped by a single backslash.
// * $ is escapes as $$.
auto printFilename = [](raw_fd_ostream &os, StringRef filename) {
llvm::SmallString<256> nativePath;
llvm::sys::path::native(filename.str(), nativePath);
llvm::sys::path::remove_dots(nativePath, /*remove_dot_dot=*/true);
for (unsigned i = 0, e = nativePath.size(); i != e; ++i) {
if (nativePath[i] == '#') {
os << '\\';
} else if (nativePath[i] == ' ') {
os << '\\';
unsigned j = i;
while (j > 0 && nativePath[--j] == '\\')
os << '\\';
} else if (nativePath[i] == '$') {
os << '$';
}
os << nativePath[i];
}
};

os << config->outputFile << ":";
for (StringRef path : config->dependencyFiles) {
os << " \\\n ";
printFilename(os, path);
}
os << "\n";

for (StringRef path : config->dependencyFiles) {
os << "\n";
printFilename(os, path);
os << ":\n";
}
}

// Replaces common symbols with defined symbols reside in .bss sections.
// This function is called after all symbol names are resolved. As a
// result, the passes after the symbol resolution won't see any
Expand Down Expand Up @@ -2134,11 +2064,6 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
return false;
});

// Since we now have a complete set of input files, we can create
// a .d file to record build dependencies.
if (!config->dependencyFile.empty())
writeDependencyFile();

// Now that the number of partitions is fixed, save a pointer to the main
// partition.
mainPart = &partitions[0];
Expand Down
1 change: 0 additions & 1 deletion lld/ELF/InputFiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ Optional<MemoryBufferRef> elf::readFile(StringRef path) {
path = saver.save(config->chroot + path);

log(path);
config->dependencyFiles.insert(path);

auto mbOrErr = MemoryBuffer::getFile(path, -1, false);
if (auto ec = mbOrErr.getError()) {
Expand Down
3 changes: 0 additions & 3 deletions lld/ELF/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@ defm demangle: B<"demangle",
"Demangle symbol names (default)",
"Do not demangle symbol names">;

defm dependency_file: EEq<"dependency-file", "Write a dependency file">,
MetaVarName<"<path>">;

def disable_new_dtags: F<"disable-new-dtags">,
HelpText<"Disable new dynamic tags">;

Expand Down
21 changes: 0 additions & 21 deletions lld/test/ELF/dependency-file.s

This file was deleted.

26 changes: 20 additions & 6 deletions lldb/tools/debugserver/source/debugserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,20 @@ RNBRunLoopMode RNBRunLoopGetStartModeFromRemote(RNBRemote *remote) {
return eRNBRunLoopModeExit;
}

// Check the name to see if it ends with .app
static bool is_dot_app (const char *app_name) {
size_t len = strlen(app_name);
if (len < 4)
return false;

if (app_name[len - 4] == '.' &&
app_name[len - 3] == 'a' &&
app_name[len - 2] == 'p' &&
app_name[len - 1] == 'p')
return true;
return false;
}

// This run loop mode will wait for the process to launch and hit its
// entry point. It will currently ignore all events except for the
// process state changed event, where it watches for the process stopped
Expand Down Expand Up @@ -200,17 +214,17 @@ RNBRunLoopMode RNBRunLoopLaunchInferior(RNBRemote *remote,

#if defined WITH_FBS
// Check if we have an app bundle, if so launch using BackBoard Services.
if (strstr(inferior_argv[0], ".app")) {
if (is_dot_app(inferior_argv[0])) {
launch_flavor = eLaunchFlavorFBS;
}
#elif defined WITH_BKS
// Check if we have an app bundle, if so launch using BackBoard Services.
if (strstr(inferior_argv[0], ".app")) {
if (is_dot_app(inferior_argv[0])) {
launch_flavor = eLaunchFlavorBKS;
}
#elif defined WITH_SPRINGBOARD
// Check if we have an app bundle, if so launch using SpringBoard.
if (strstr(inferior_argv[0], ".app")) {
if (is_dot_app(inferior_argv[0])) {
launch_flavor = eLaunchFlavorSpringBoard;
}
#endif
Expand Down Expand Up @@ -1499,17 +1513,17 @@ int main(int argc, char *argv[]) {

#if defined WITH_FBS
// Check if we have an app bundle, if so launch using SpringBoard.
if (waitfor_pid_name.find(".app") != std::string::npos) {
if (is_dot_app(waitfor_pid_name.c_str())) {
launch_flavor = eLaunchFlavorFBS;
}
#elif defined WITH_BKS
// Check if we have an app bundle, if so launch using SpringBoard.
if (waitfor_pid_name.find(".app") != std::string::npos) {
if (is_dot_app(waitfor_pid_name.c_str())) {
launch_flavor = eLaunchFlavorBKS;
}
#elif defined WITH_SPRINGBOARD
// Check if we have an app bundle, if so launch using SpringBoard.
if (waitfor_pid_name.find(".app") != std::string::npos) {
if (is_dot_app(waitfor_pid_name.c_str())) {
launch_flavor = eLaunchFlavorSpringBoard;
}
#endif
Expand Down
8 changes: 4 additions & 4 deletions llvm-spirv/lib/SPIRV/OCL20ToSPIRV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,7 @@ void OCL20ToSPIRV::visitCallEnqueueKernel(CallInst *CI,

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

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

auto *BlockF = cast<Function>(getUnderlyingObject(BlockFVal, DL));
auto *BlockF = cast<Function>(getUnderlyingObject(BlockFVal));

AttributeList Attrs = CI->getCalledFunction()->getAttributes();
mutateCallInst(M, CI,
[=](CallInst *CI, std::vector<Value *> &Args) {
Value *Param = *Args.rbegin();
Type *ParamType = getUnderlyingObject(Param, DL)->getType();
Type *ParamType = getUnderlyingObject(Param)->getType();
if (PointerType *PT = dyn_cast<PointerType>(ParamType)) {
ParamType = PT->getElementType();
}
Expand Down
9 changes: 4 additions & 5 deletions llvm/include/llvm/Analysis/ObjCARCAnalysisUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ inline bool ModuleHasARC(const Module &M) {
/// This is a wrapper around getUnderlyingObject which also knows how to
/// look through objc_retain and objc_autorelease calls, which we know to return
/// their argument verbatim.
inline const Value *GetUnderlyingObjCPtr(const Value *V,
const DataLayout &DL) {
inline const Value *GetUnderlyingObjCPtr(const Value *V) {
for (;;) {
V = getUnderlyingObject(V, DL);
V = getUnderlyingObject(V);
if (!IsForwarding(GetBasicARCInstKind(V)))
break;
V = cast<CallInst>(V)->getArgOperand(0);
Expand All @@ -78,12 +77,12 @@ inline const Value *GetUnderlyingObjCPtr(const Value *V,

/// A wrapper for GetUnderlyingObjCPtr used for results memoization.
inline const Value *
GetUnderlyingObjCPtrCached(const Value *V, const DataLayout &DL,
GetUnderlyingObjCPtrCached(const Value *V,
DenseMap<const Value *, WeakTrackingVH> &Cache) {
if (auto InCache = Cache.lookup(V))
return InCache;

const Value *Computed = GetUnderlyingObjCPtr(V, DL);
const Value *Computed = GetUnderlyingObjCPtr(V);
Cache[V] = const_cast<Value *>(Computed);
return Computed;
}
Expand Down
Loading

0 comments on commit 09a1240

Please sign in to comment.