The zext constant expression was detected by the fold, but then
handled as a sext. Use ZExtOperator instead of ZExtInst to handle
constant expressions.
Fixes https://github.com/llvm/llvm-project/issues/64669.
(cherry picked from commit c15ccfb24afa67d3c3f54e52cc1d1afa564715ed)
Add support for DONE, RETRY, SAVED, and RESTORED (v9 Section A.11 & Section A.47).
Those instructions are used for low-level interrupt handling and register window
management by OS kernels.
Reviewed By: barannikov88
Differential Revision: https://reviews.llvm.org/D144936
(cherry picked from commit bf499ec2b96c98633a8b2bc2113b19ffd437f647)
D152276 wasn't handling the case where the inserted element is implicitly truncated into the vector - resulting in a i1 element (implicitly truncated from i8) overwriting 8 bits instead of 1 bit.
This patch is intended to be merged into 17.x so I've just disallowed any vector element vs inserted element type mismatch - technically we could be more elegant and permit truncated stores (as long as the store is still byte sized), but the use cases for that are so limited I'd prefer to play it safe for now.
Candidate patch for #64655 17.x merge
Differential Revision: https://reviews.llvm.org/D158366
(cherry picked from commit ba818c4019c550e1a413e1563a05b241b508defd)
In D146245, we have supported lowering inline asm `m` with offset
to `register+imm`, but we didn't handle the case that the offset
is the low part of global address.
This patch will emit `%lo(g)` when `g` is a global address.
Fixes#64656
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D157839
(cherry picked from commit dc60003ec8b2faf595b528a39f64b697a589da06)
We will need to check the output of medium code model.
Reviewed By: wangpc
Differential Revision: https://reviews.llvm.org/D157965
(cherry picked from commit a3b11ce78680ef39e4dfbc72085ae3e1814e3cba)
This fixes a regression since 1c10d5b175992a9d056a2d763a932e5652386fc1
/ https://reviews.llvm.org/D130903 by applying the same fix from
SelectionDAG from 8cb3667541a94c4fa11b06e19020f753414c1d03 /
https://reviews.llvm.org/D35720.
This could possibly have been detected if the existing testcases
in win64_vararg.ll had been tested with GlobalISel too, but all
the IR snippets there fail to be translated with GlobalISel.
This adds a separate testcase based on real world LLVM IR (instead of
hand-reduced IR), which GlobalISel does translate happily - tested
with both SelectionDAG and GlobalISel.
Before this change, the stack object locations (visible in MIR
with "llc -print-after-all") didn't match with what the prologue
emitted by AArch64FrameLowering actually looked like, which caused
clobbered callee saved registers when function local stack objects
aliased the actual location of the callee saved registers.
This fixes https://github.com/llvm/llvm-project/issues/64740.
Differential Revision: https://reviews.llvm.org/D158272
(cherry picked from commit 955d7615bd7563cc78a5106215daf9e6e47ffb5e)
We were calling `isFunctionProtoType()` on a `ParsedType` rather than
creating a valid semantic type first and calling the function on that.
The call to `isFunctionProtoType()` would eventually call
`getUnqualifiedDesugaredType()`, which loops indefinitely until we get
a desugared type and a `ParsedType` will never finish desugaring.
Fixes https://github.com/llvm/llvm-project/issues/64713
In SystemZTTIImpl::getMemoryOpCost, the call to getNumberOfParts will
run type legalization, which can't handle structs. So before that, we
check for an unknown value type and forward to BaseT, just like many
other targets do in this situation.
https://bugzilla.redhat.com/show_bug.cgi?id=2224885
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D156379
(cherry picked from commit 85e4ee15d32ae0344755d11d4ca90a15a6e005cd)
As described in Issue #53709
<https://github.com/llvm/llvm-project/issues/53709>, since
28d58d8fe2094af6902dee7b4d68ec30a3e9d737
<https://reviews.llvm.org/rG28d58d8fe2094af6902dee7b4d68ec30a3e9d737>
`clang` doesn't find the latest of several parallel GCC installations on
Solaris, but only the first in directory order, which is pretty random.
This patch sorts GCC installations in reverse version order so the latest
is picked.
Tested on `sparcv9-sun-solaris2.11`, `amd64-pc-solaris2.11`, and
`x86_64-pc-linux-gnu`.
Differential Revision: https://reviews.llvm.org/D157275
(cherry picked from commit ae84ad15efd7ef7da95146e900ec72ceadf98058)
getUBSanFunctionTypeHash.
getUBSanFunctionTypeHash checks if a Type is a FunctionNoPrototype
by calling isa<FunctionNoProtoType>(). This does not work correctly when
the Type is wrapped in a sugar type such as an AttributedType. This
patch fixes this by using isFunctionNoProtoType() function which removes
sugar and returns the expected result.
The added test is a sanity check that the compiler no longer crashes
during compilation. It also compares the hash with and without the
function attribute for both FunctionNoProtoType and FunctionProtoType.
The hash remains the same for FunctionNoProtoType even with the addition
of an attribute.
rdar://113144087
Differential Revision: https://reviews.llvm.org/D157445
(cherry picked from commit 9afc57dcb2e5cd36ca1ddf0fee3efa958bfd4c2a)
Constructs such as inline variables, #line, and #include can create
lexical blocks with a different filename.
GCOVProfiling and llvm-cov gcov currently don't handle such cases (see
GCOVLines::writeOut and GCOVFile::readGCNO) and would incorrectly
attribute the line number to the current file.
For now, ignore such blocks. Missing line execution counts is better
than wrong ones.
---
As a workaround that Apple targets don't use -mconstructor-aliases yet,
allow line execution count 4 on the A::A line (1f34e282e8066281eb1447e21e44a2a2e9983e79).
(cherry picked from commit 406e81b79d26dae6838cc69d10a3e22635da09ef)
assert is more appropriate here and fixes
`runtime error: execution reached an unreachable program point` in a
-DLLVM_USE_SANITIZER=Undefined build (-fno-sanitize-recover=all causes
llc to exit instead of crash (report_fatal_error)) when testing
MachineVerifier/test_g_assert_[sz]ext.mir.
(cherry picked from commit a7e20dd664bbce6e87b1fdad88d719e497902a42)
Tested by llvm/test/MC/ARM/basic-thumb2-instructions.s.
Caught by newer -fsanitize=signed-integer-overflow (D156821).
(cherry picked from commit d8900f661a6e451be0ca253df3065254008dd93a)
clang recently started checking for INT64_MIN being passed to 64-bit std::abs.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D158304
(cherry picked from commit 078eb4bd85ddaac530bf2919bb32c6daa6c3e36f)
D155991 changed the file lookup to do a full string compare on the
filename; however, this added ~0.5% to compile time with -g.
Go back to the previous pointer-based lookup, but capture the main
file's checksum as well as its name to use when creating the extra
DIFile entry. This causes all entries to be consistent and also
avoids computing the checksum twice.
This reverts commit 5956648fc3ba11dd6b0d0f2d1d9b923e7f80f247.
There was a string lifetime issue that is now corrected.
Differential Revision: https://reviews.llvm.org/D156571
(cherry picked from commit 1fcc2bc31bb9352a13445ff4a5cccb0bebb8ea5b)
An inline virtual function must be emitted, but we need to remember
it and emit the same definition again in the future in case later
LLVM optimizations stripped it from the Module. The added test case
shows the problem; before this patch, it would fail with:
Symbols not found: [ _ZN1AD0Ev, _ZN1AD1Ev ]
This reapplies commit f8dadefd4a, reverted in commit 0e17372b38, but
disables RTTI in the test to avoid problems on Windows.
Differential Revision: https://reviews.llvm.org/D156537
(cherry picked from commit c861d32d7c2791bdc058d9d9fbaecc1c2f07b8c7)
Reemission is only needed in incremental mode. With this early return,
we avoid overhead from addEmittedDeferredDecl in non-incremental mode.
Differential Revision: https://reviews.llvm.org/D157379
(cherry picked from commit d43a3d6346961e639e29b8083b262416889e78ec)
GlobalDecls should only be added to EmittedDeferredDecls if they
need reemission. This is checked in addEmittedDeferredDecl, which
is called via addDeferredDeclToEmit. Extend these checks to also
handle VarDecls (for lambdas, as tested in Interpreter/lambda.cpp)
and remove the direct access of EmittedDeferredDecls in EmitGlobal
that may actually end up duplicating FunctionDecls.
Differential Revision: https://reviews.llvm.org/D156897
(cherry picked from commit b719e410781ce9f3a2b316afea31c156bf99e036)
This was unused since commit dd2362a8ba last year.
Differential Revision: https://reviews.llvm.org/D156891
(cherry picked from commit 2f3fe3ed97bcf778d73eda5aae9f166810a4af02)
A double colon starts an identifier name in the global namespace and
must be tentatively parsed as such.
Differential Revision: https://reviews.llvm.org/D157480
(cherry picked from commit ba475a4a3440a21e5de6a39a16215836f2614f04)
We added support for the GNUstep ObjC runtime in 0b6264738f3d. In order to check if the target process uses
GNUstep we run an expensive symbol lookup in `CreateInstance()`. This turned out to cause a heavy performance
regression for non-GNUstep inferiors.
This patch puts a cheaper check in front, so that the vast majority of requests should return early. This
should fix the symptom for the moment. The conceptual question remains: Why does `LanguageRuntime::FindPlugin`
invoke `create_callback` for each available runtime unconditionally in every `Process::ModulesDidLoad`?
Reviewed By: jasonmolenda, jingham, bulbazord
Differential Revision: https://reviews.llvm.org/D158205
(cherry picked from commit af2eb838309d88f046d34bca6055f1de6078fa3b)
FatLTO support is only half complete, and shouldn't be included in the
17.x release. https://reviews.llvm.org/D152973.
This reverts commit 5784c47806cf276e8fcc1311201f437cb8169261.
This reverts commit 610fc5cbcc8b68879c562f6458608afe2473ab7f.
This patch fixes a few CMake options that were set using incorrect
mechanisms.
CMake's man page for the -D <var>=<value> option states: If a command in
the project sets the type to PATH or FILEPATH, then the <value> will be
converted to an absolute path. That's not what we want for most of the
paths we have as configuration options. Otherwise, using -D to set the
configuration option results in an absolute path being used, which
breaks things.
option() denotes a boolean variable, but what was desired was a
string/list variable. Fix this to prevent cmake from changing any
non-empty user provided values to 'ON'.
Differential Revision: https://reviews.llvm.org/D157926
(cherry picked from commit 760261a3daf98882ccbd177e3133fb4a058f47ad)
Also `istringstream::str()` and `ostringstrem::str()`.
https://github.com/llvm/llvm-project/issues/40363 causes `str()`
to be dllimport'ed despite _LIBCPP_HIDE_FROM_ABI.
This is a temporary solution until #40363 is fixed.
Reviewed By: #libc, thakis, philnik
Differential Revision: https://reviews.llvm.org/D157602
(cherry picked from commit 090996f4a1186b1522e1225b6779d74ce9da250c)
Mirror of the previous log changes, OpenCL conformance doesn't like
interpreting afn as ignore denormal handling but was previously hidden
by flag dropping.
(cherry picked from commit 81b278e613fb3bcdf8053f7a6b5dd2f3881898d2)
OpenCL conformance didn't like interpreting afn as ignore the denormal
handling.
https://reviews.llvm.org/D157940
(cherry picked from commit 4b7b4b945856c46b91ade7b6c4264fe8e258367e)
Apparently afn doesn't allow you to drop the denormal handling
according to OpenCL conformance. This was hidden by losing the flags
during the library linking process. Fast log is still broken and needs
more work.
https://reviews.llvm.org/D157936
(cherry picked from commit e09b3593ba64d004a9d2b3fa41be2ba84f968a88)
We should query the subtarget of the calling function, not of the
intrinsic.
This probably makes no functional difference (as libcalls are
unlikely to vary across subtargets), but fixes minor compile-time
regressions from unnecessary subtarget instantiations.
Followup to D157567.
Differential Revision: https://reviews.llvm.org/D157848
(cherry picked from commit 66bb7521625826cab6fcc24662c053deee1ef90c)
We need a better mechanism for expressing which calls you are allowed
to emit and which calls are recognized. This should be applied to the
17 branch.
(cherry picked from commit c8cac156135de8e211b800ea5abe9666803b2875)
PSTL contains many pragmas that request loop vectorization, which would
produce a warning when the compiler is unable to fulfill the request (if
`-Wpass-failed` is enabled). This is normal and expected in some cases,
and we don't want `-Werror` to turn that into a compilation failure.
Differential Revision: https://reviews.llvm.org/D157145
(cherry picked from commit 1d340250a894b6ec956e2145b2fc7babbf83e61b)
The subtarget was unconditionally reporting that SVE was to be used to
lower vectors when Neon was unavailable, even when SVE itself was
unavailable. This decision leads other parts of the compiler to crash,
e.g., when querying SVE vector sizes.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D158179
(cherry picked from commit c058eb998aa6fa89d412984d6cbf9e3f826249f3)
Previously when objcopy generated section headers, it padded the LEB
that encodes the section size out to 5 bytes, matching the behavior of
clang. This is correct, but results in a binary that differs from the
input. This can sometimes have undesirable consequences (e.g. breaking
source maps).
This change makes the object reader remember the size of the LEB
encoding in the section header, so that llvm-objcopy can reproduce it
exactly. For sections not read from an object file (e.g. that
llvm-objcopy is adding itself), pad to 5 bytes.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D155535
(cherry picked from commit 1b21067cf247c62c2442daa7ee2d3915249d1ee2)
FRINT was added to matchRoundingOp after this function was written.
So FRINT was not tested originally.
For vectors, folding this causes us to create a CSR swap that tries
to write 7 to FRM. This is an illegal value and will cause the CSR
write to fail.
While this might be a legal fold we could do, I'm disabling it for
now so we can backport to LLVM 17 with the least risk.
Differential Revision: https://reviews.llvm.org/D157583
(cherry picked from commit 2df9328fe3a0575fa415964a3c3544b0912b168e)
Relative to the previous attempt, this also adjusts RegionInfo
verification to allow unreachable predecessors.
-----
If a block in the CHR region has an unreachable predecessor, then
there will be no edge from that predecessor to the newly cloned
block. However, a phi node entry for it will be left behind. Make
sure that these incoming blocks get dropped as well.
Fixes https://github.com/llvm/llvm-project/issues/64594.
Differential Revision: https://reviews.llvm.org/D157621
(cherry picked from commit 7e2f1ae7e0ebc7e71ffaa865175aef27fae3b034)
This reverts commit 985486dca48bffd9e991d9f5ac32e1d109ae000f.
This seems to cause malformed profdata: crbug.com/1469456
(cherry picked from commit 4b08be77c98a4c15b8b3d634fab4ffc24bf4ef38)