- Jul 26, 2019
-
-
Francis Visoiu Mistrih authored
Currently, stack protector loads and stores are resolved during LocalStackSlotAllocation (if the pass needs to run). When this is the case, the base register assigned to the frame access is going to be one of the vregs created during LocalStackSlotAllocation. This means that we are keeping a pointer to the stack protector slot, and we're using this pointer to load and store to it. In case register pressure goes up, we may end up spilling this pointer to the stack, which can be a security concern. Instead, leave it to PEI to resolve the frame accesses. In order to do that, we make all stack protector accesses go through frame index operands, then PEI will resolve this using an offset from sp/fp/bp. Differential Revision: https://reviews.llvm.org/D64759 llvm-svn: 367068
-
George Burgess IV authored
This CL adds an optional warning to diagnose uses of the `__builtin_alloca` family of functions. The use of these functions is discouraged by many, so it seems like a good idea to allow clang to warn about it. Patch by Elaina Guan! Differential Revision: https://reviews.llvm.org/D64883 llvm-svn: 367067
-
Jonas Devlieghere authored
Jim pointed out that this was still open on the website. llvm-svn: 367066
-
Jonas Devlieghere authored
The printEscapedString would escape newlines by their ASCII values instead of prefixing them with a `\`. Remove the escaping logic and escape the strings in the definition file. llvm-svn: 367065
-
Pirama Arumuga Nainar authored
Summary: In Android, attempting to mkdir() or even stat() top-level directories like /data causes noisy selinux denials. During whole-system coverage instrumentation, this causes a deluge of noisy messages that drown out legitimate selinux denials, that should be audited and fixed. To avoid this, skip creating any directory in GCOV_PREFIX (thereby assuming that it exists). - Android platform ensures that the GCOV_PREFIX used in Android is created and read/writable by all processes. - This only affects the Android platform (by checking against __ANDROID_API_FUTURE__) and for apps built with Clang coverage, the runtime will still create any non-existent parent directories for the coverage files. Reviewers: srhines, davidxl Subscribers: krytarowski, #sanitizers, danalbert, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D65245 llvm-svn: 367064
-
Puyan Lotfi authored
- Removing a few of the entries in the Flags for the Types.def table. - Removing redundant parts of getCompilationPhases(). Flags have been removed from Types.def: a - The type should only be assembled: Now, check that Phases contains phases::Assemble but not phases::Compile or phases::Backend. p - The type should only be precompiled: Now, check that Phases contains phases::Precompile but that Flags does not contain 'm'. m - Precompiling this type produces a module file: Now, check that isPrepeocessedModuleType. Differential Revision: https://reviews.llvm.org/D65176 llvm-svn: 367063
-
- Jul 25, 2019
-
-
Yonghong Song authored
Currently, the CO-RE offset relocation does not work if any struct/union member or array element is a typedef. For example, typedef const int arr_t[7]; struct input { arr_t a; }; func(...) { struct input *in = ...; ... __builtin_preserve_access_index(&in->a[1]) ... } The BPF backend calculated default offset is 0 while 4 is the correct answer. Similar issues exist for struct/union typedef's. When getting struct/union member or array element type, we should trace down to the type by skipping typedef and qualifiers const/volatile as this is what clang did to generate getelementptr instructions. (const/volatile member type qualifiers are already ignored by clang.) This patch fixed this issue, for each access index, skipping typedef and const/volatile/restrict BTF types. Signed-off-by:
Yonghong Song <yhs@fb.com> Differential Revision: https://reviews.llvm.org/D65259 llvm-svn: 367062
-
Alex Lorenz authored
The file collector class is useful for constructing reproducers by creating a snapshot of the files that are accessed. Sometimes it might also be important to construct directories that don't necessarily have files, but are still accessed by some tool that we want to make a reproducer for. This is useful for instance for modeling the behavior of Clang's header search, which scans through a number of directories it doesn't actually access when looking for framework headers. This commit extends the file collector to allow it to work with paths that are just directories, by constructing them as the files are copied over. Differential Revision: https://reviews.llvm.org/D65297 llvm-svn: 367061
-
Amara Emerson authored
Changes the order of legalization of G_ICMP suggested by Petar in D65079. llvm-svn: 367060
-
Jim Ingham authored
llvm-svn: 367059
-
Jonas Devlieghere authored
Property definitions are currently defined in a PropertyDefinition array and have a corresponding enum to index in this array. Unfortunately this is quite error prone. Indeed, just today we found an incorrect merge where a discrepancy between the order of the enum values and their definition caused the test suite to fail spectacularly. Tablegen can streamline the process of generating the property definition table while at the same time guaranteeing that the enums stay in sync. That's exactly what this patch does. It adds a new tablegen file for the properties, building on top of the infrastructure that Raphael added recently for the command options. It also introduces two new tablegen backends: one for the property definitions and one for their corresponding enums. It might be worth mentioning that I generated most of the tablegen definitions from the existing property definitions, by adding a dump method to the struct. This seems both more efficient and less error prone that copying everything over by hand. Only Enum properties needed manual fixup for the EnumValues and DefaultEnumValue fields. Differential revision: https://reviews.llvm.org/D65185 llvm-svn: 367058
-
Jim Ingham authored
llvm-svn: 367057
-
Diego Astiazaran authored
A default css stylesheet is included for docs generated in html format. Differential Revision: https://reviews.llvm.org/D64539 llvm-svn: 367056
-
Saleem Abdulrasool authored
This reverts commit fd1274fa78cb0fd32cc1fa2e6f5bb8e62d29df19. Add an explicit triple for the test which is pattern matching overly aggressively. llvm-svn: 367055
-
Jonas Devlieghere authored
Dotest contains code to clear DYLD_LIBRARY_PATH for the inferior to not propagate sanitized builds. However, it's possible that we want to inject a different library path with `--inferior-env`. To make that work correctly, we need to do that *after* clearing DYLD_LIBRARY_PATH. llvm-svn: 367054
-
Leonard Chan authored
changes were made to the patch since then. -------- [NewPM] Port Sancov This patch contains a port of SanitizerCoverage to the new pass manager. This one's a bit hefty. Changes: - Split SanitizerCoverageModule into 2 SanitizerCoverage for passing over functions and ModuleSanitizerCoverage for passing over modules. - ModuleSanitizerCoverage exists for adding 2 module level calls to initialization functions but only if there's a function that was instrumented by sancov. - Added legacy and new PM wrapper classes that own instances of the 2 new classes. - Update llvm tests and add clang tests. llvm-svn: 367053
-
Antonio Afonso authored
Summary: This might be an edge case in regular use but if you're shipping an lldb version with no debugserver lldb will try to use the System one. However, lldb only knows how to find the Xcode one and not the Command Line Tools one. This diff fixes that. We try to find debugserver with `PlatformDarwin::LocateExecutable("debugserver")`, we call `xcode-select -p` to get the path and then assume this path is of Xcode. The changes I did are: * Change `PlatformDarwin::LocateExecutable` to also add the Command Line Tools directory to the list of paths to search for debugserver. * Created a new function to find the Command Line Tools directory named `GetCommandLineToolsLibraryPath`. * Refactored the code that calls `xcode-select -p` into its own function `GetXcodeSelectPath()`. There were 2 identical pieces of code for this so I reduced it to one and used this function everywhere instead. * I also changed `PlatformDarwin::GetSDKDirectoryForModules` to use the `SDKs` directory that exists in the Command Line Tools installation. I'm not sure how to create tests for this. PlatformDarwinTest is really limited and I couldn't find how to mock Filesystem::Instance() so I could create a virtual file system. Reviewers: clayborg, JDevlieghere Reviewed By: clayborg, JDevlieghere Subscribers: jasonmolenda, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D65171 llvm-svn: 367052
-
JF Bastien authored
Originally in https://reviews.llvm.org/D64656 Causes bot failures: /home/buildslave/buildslave/clang-cmake-armv8-full/llvm/tools/clang/test/CodeGenCXX/pr40771-ctad-with-lambda-copy-capture.cpp:20:16: error: CHECK-NEXT: expected string not found in input // CHECK-NEXT: call void @_ZN1RC1E1Q(%struct.R* [[TMP_R]]) ^ <stdin>:37:2: note: scanning from here %8 = call %struct.R* @_ZN1RC1E1Q(%struct.R* %1) ^ <stdin>:37:2: note: with "TMP_R" equal to "%1" %8 = call %struct.R* @_ZN1RC1E1Q(%struct.R* %1) ^ <stdin>:37:17: note: possible intended match here %8 = call %struct.R* @_ZN1RC1E1Q(%struct.R* %1) ^ llvm-svn: 367051
-
Diego Astiazaran authored
The children of a TagNode are rendered in the same line as the parent only if they are all TextNodes. When children are not inline; two text nodes that are adjacent won't have a new line between them, each tag node is rendered in its own line. Differential Revision: https://reviews.llvm.org/D65005 llvm-svn: 367050
-
Florian Hahn authored
Currently there are a few pointer comparisons in ValueDFS_Compare, which can cause non-deterministic ordering when materializing values. There are 2 cases this patch fixes: 1. Order defs before uses used to compare pointers, which guarantees defs before uses, but causes non-deterministic ordering between 2 uses or 2 defs, depending on the allocation order. By converting the pointers to booleans, we can circumvent that problem. 2. comparePHIRelated was comparing the basic block pointers of edges, which also results in a non-deterministic order and is also not really meaningful for ordering. By ordering by their destination DFS numbers we guarantee a deterministic order. For the example below, we can end up with 2 different uselist orderings, when running `opt -mem2reg -ipsccp` hundreds of times. Because the non-determinism is caused by allocation ordering, we cannot reproduce it with ipsccp alone. declare i32 @hoge() local_unnamed_addr #0 define dso_local i32 @ham(i8* %arg, i8* %arg1) #0 { bb: %tmp = alloca i32 %tmp2 = alloca i32, align 4 br label %bb19 bb4: ; preds = %bb20 br label %bb6 bb6: ; preds = %bb4 %tmp7 = call i32 @hoge() store i32 %tmp7, i32* %tmp %tmp8 = load i32, i32* %tmp %tmp9 = icmp eq i32 %tmp8, 912730082 %tmp10 = load i32, i32* %tmp br i1 %tmp9, label %bb11, label %bb16 bb11: ; preds = %bb6 unreachable bb13: ; preds = %bb20 br label %bb14 bb14: ; preds = %bb13 %tmp15 = load i32, i32* %tmp br label %bb16 bb16: ; preds = %bb14, %bb6 %tmp17 = phi i32 [ %tmp10, %bb6 ], [ 0, %bb14 ] br label %bb19 bb18: ; preds = %bb20 unreachable bb19: ; preds = %bb16, %bb br label %bb20 bb20: ; preds = %bb19 indirectbr i8* null, [label %bb4, label %bb13, label %bb18] } Reviewers: davide, efriedma Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D64866 llvm-svn: 367049
-
Louis Dionne authored
Leaving some comments behind so that we avoid re-having that discussion in the future. llvm-svn: 367048
-
Michal Gorny authored
Mark the process as stopped when SIGSTOP arrives. This is necessary for lldb-server to generate correct response to 'process interrupt', and therefore to prevent the whole stack crashing when process is stopped. Thanks to Pavel Labath for the tip. Differential Revision: https://reviews.llvm.org/D65289 llvm-svn: 367047
-
Roman Lebedev authored
As discussed in https://bugs.llvm.org/show_bug.cgi?id=42673 there is a TTI hook hasDivRemOp() that matters here. While -div-rem-pairs will decompose 'rem' if that hook returns false, nothing does the opposite transform. We can't to this in InstCombine, because it does not currently access TTI, and i'm not sure we should change that. We can't really do that in DAGCombine since it also currently does not access TTI. Therefore only DivRemPairs is left. https://bugs.llvm.org/show_bug.cgi?id=42673 llvm-svn: 367046
-
Diego Astiazaran authored
Replace &, <, >, ", and ' with their corresponding html entities in text rendered by HTML generator. Differential Revision: https://reviews.llvm.org/D65107 llvm-svn: 367045
-
Serguei Katkov authored
We'd like to determine the idom of exit block after peeling one iteration. Let Exit is exit block. Let ExitingSet - is a set of predecessors of Exit block. They are exiting blocks. Let Latch' and ExitingSet' are copies after a peeling. We'd like to find an idom'(Exit) - idom of Exit after peeling. It is an evident that idom'(Exit) will be the nearest common dominator of ExitingSet and ExitingSet'. idom(Exit) is a nearest common dominator of ExitingSet. idom(Exit)' is a nearest common dominator of ExitingSet'. Taking into account that we have a single Latch, Latch' will dominate Header and idom(Exit). So the idom'(Exit) is nearest common dominator of idom(Exit)' and Latch'. All these basic blocks are in the same loop, so what we find is (nearest common dominator of idom(Exit) and Latch)'. Reviewers: reames, fhahn Reviewed By: reames Subscribers: hiraditya, zzheng, llvm-commits Differential Revision: https://reviews.llvm.org/D65292 llvm-svn: 367044
-
Whitney Tsang authored
as DDG and PDG. Summary: This is an implementation of a directed graph base class with explicit representation of both nodes and edges. This implementation makes the edges explicit because we expect to assign various attributes (such as dependence type, distribution interference weight, etc) to the edges in the derived classes such as DDG and DIG. The DirectedGraph consists of a list of DGNode's. Each node consists of a (possibly empty) list of outgoing edges to other nodes in the graph. A DGEdge contains a reference to a single target node. Note that nodes do not know about their incoming edges so the DirectedGraph class provides a function to find all incoming edges to a given node. This is the first patch in a series of patches that we are planning to contribute upstream in order to implement Data Dependence Graph and Program Dependence Graph. More information about the proposed design can be found here: https://ibm.ent.box.com/v/directed-graph-and-ddg Authored By: bmahjour Reviewer: Meinersbur, myhsum hfinkel, fhahn, jdoerfert, kbarton Reviewed By: Meinersbur Subscribers: mgorny, wuzish, jsji, lebedev.ri, dexonsmith, kristina, llvm-commits, Whitney, etiotto Tag: LLVM Differential Revision: https://reviews.llvm.org/D64088 llvm-svn: 367043
-
Saleem Abdulrasool authored
A placeholder instruction for use in generation of cleanup code for an initializer list would not be emitted if the base class contained a non-trivial destructor and the class contains no fields of its own. This would be the case when using CTAD to deduce the template arguments for a struct with an overloaded call operator, e.g. ``` template <class... Ts> struct ctad : Ts... {}; template <class... Ts> ctad(Ts...)->ctad<Ts...>; ``` and this class was initialized with a list of lambdas capturing by copy, e.g. ``` ctad c {[s](short){}, [s](long){}}; ``` In a release build the bug would manifest itself as a crash in the SROA pass, however, in a debug build the following assert in CGCleanup.cpp would fail: ``` assert(dominatingIP && "no existing variable and no dominating IP!"); ``` By ensuring that a placeholder instruction is emitted even if there's no fields in the class, neither the assert nor the crash is reproducible. See https://bugs.llvm.org/show_bug.cgi?id=40771 Patch by Øystein Dale! llvm-svn: 367042
-
Jonas Hahnfeld authored
Both Clang and GCC complained that they cannot initialize a return object of type 'kmp_proc_bind_t' with an 'int'. While at it, also fix a warning about missing parentheses thrown by Clang. Differential Revision: https://reviews.llvm.org/D65284 llvm-svn: 367041
-
Matthias Gehre authored
Summary: This is the first part of work announced in "[RFC] Adding lifetime analysis to clang" [0], i.e. the addition of the [[gsl::Owner(T)]] and [[gsl::Pointer(T)]] attributes, which will enable user-defined types to participate in the lifetime analysis (which will be part of the next PR). The type `T` here is called "DerefType" in the paper, and denotes the type that an Owner owns and a Pointer points to. E.g. `std::vector<int>` should be annotated with `[[gsl::Owner(int)]]` and a `std::vector<int>::iterator` with `[[gsl::Pointer(int)]]`. [0] http://lists.llvm.org/pipermail/cfe-dev/2018-November/060355.html Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63954 llvm-svn: 367040
-
Erich Keane authored
This seems to be an old vestage of a previous implementation of getting the default calling convention, and everything is now using CXXABI/ASTContext's getDefaultCallingConvention. Remove it, since it isn't doing anything. llvm-svn: 367039
-
Erich Keane authored
llvm-svn: 367038
-
Sanjay Patel authored
Later code in TryToSimplifyUncondBranchFromEmptyBlock() assumes that we have cleaned up unreachable blocks, but that was not happening with this switch transform. llvm-svn: 367037
-
JF Bastien authored
It doesn't like function attributes on definitions, only declarations. llvm-svn: 367036
-
JF Bastien authored
llvm-svn: 367035
-
Roman Lebedev authored
As discussed in https://bugs.llvm.org/show_bug.cgi?id=42673 there is a TTI hook hasDivRemOp() that matters here. While -div-rem-pairs will decompose 'rem' if that hook returns false, nothing does the opposite transform. We can't to this in InstCombine, because it does not currently access TTI, and i'm not sure we should change that. We may be able to teach DivRemPairs to do this, but this really is a per-target perf optimization, and we seem to do the opposite transform in backend if hasDivRemOp() returned false: https://godbolt.org/z/ttt4HZ I think it makes sense to be consistent. https://bugs.llvm.org/show_bug.cgi?id=42673 llvm-svn: 367034
-
Whitney Tsang authored
Summary: This is the first patch for the loop guard. We introduced getLoopGuardBranch() and isGuarded(). This currently only works on simplified loop, as it requires a preheader and a latch to identify the guard. It will work on loops of the form: /// GuardBB: /// br cond1, Preheader, ExitSucc <== GuardBranch /// Preheader: /// br Header /// Header: /// ... /// br Latch /// Latch: /// br cond2, Header, ExitBlock /// ExitBlock: /// br ExitSucc /// ExitSucc: Prior discussions leading upto the decision to introduce the loop guard API: http://lists.llvm.org/pipermail/llvm-dev/2019-May/132607.html Reviewer: reames, kbarton, hfinkel, jdoerfert, Meinersbur, dmgreen Reviewed By: reames Subscribers: wuzish, hiraditya, jsji, llvm-commits, bmahjour, etiotto Tag: LLVM Differential Revision: https://reviews.llvm.org/D63885 llvm-svn: 367033
-
JF Bastien authored
Summary: This is useful for targets which have prefetch instructions for non-default address spaces. <rdar://problem/42662136> Subscribers: nemanjai, javed.absar, hiraditya, kbarton, jkorous, dexonsmith, cfe-commits, llvm-commits, RKSimon, hfinkel, t.p.northover, craig.topper, anemet Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D65254 llvm-svn: 367032
-
JF Bastien authored
Summary: Looking at the current Apple-specific code for crash handling it does a few silly things that I think we should avoid while handling crashes: * Try real hard not to allocate. * Set the global crash reporter string early so that any crash while generating the stack trace will still report some info. * Prevent reordering of operations in the current thread. <rdar://problem/53503334> Subscribers: hiraditya, jkorous, dexonsmith, llvm-commits, beanz, Bigcheese, thakis, lattner, jordan_rose Tags: #llvm Differential Revision: https://reviews.llvm.org/D65235 llvm-svn: 367031
-
Yonghong Song authored
Currently, we expect the CO-RE offset relocation records a string encoding the original getelementptr access index, so kernel bpf loader can decode it correctly. For example, struct s { int a; int b; }; struct t { int c; int d; }; #define _(x) (__builtin_preserve_access_index(x)) int get_value(const void *addr1, const void *addr2); int test(struct s *arg1, struct t *arg2) { return get_value(_(&arg1->b), _(&arg2->d)); } We expect two offset relocations: reloc 1: type s, access index 0, 1 reloc 2: type t, access index 0, 1 Two globals are created to retain access indexes for the above two relocations with global variable names. The first global has a name "0:1:". Unfortunately, the second global has the name "0:1:.1" as the llvm internals automatically add suffix ".1" to a global with the same name. Later on, the BPF peels the last character and record "0:1" and "0:1:." in the relocation table. This is not desirable. BPF backend could use the global variable suffix knowledge to generate correct access str. This patch rather took an approach not relying on that knowledge. It generates "s:0:1:" and "t:0:1:" to avoid global variable suffixes and later on generate correct index access string "0:1" for both records. Signed-off-by:
Yonghong Song <yhs@fb.com> Differential Revision: https://reviews.llvm.org/D65258 llvm-svn: 367030
-
Vlad Tsyrklevich authored
This reverts commit bc4a63fd, this is a speculative revert to fix a number of sanitizer bots (like sanitizer-x86_64-linux-bootstrap-ubsan) that have started to see stage2 compiler crashes, presumably due to a miscompile. llvm-svn: 367029
-