[llvm-branch-commits] [libcxx] 4327d39 - [libcxx] Add an explicit option to build against system-libcxxabi
Author: Michał Górny
Date: 2022-03-01T13:45:45-05:00
New Revision: 4327d39b15b22b9ee23582e5455df5b2a093fe8d
URL:
https://github.com/llvm/llvm-project/commit/4327d39b15b22b9ee23582e5455df5b2a093fe8d
DIFF:
https://github.com/llvm/llvm-project/commit/4327d39b15b22b9ee23582e5455df5b2a093fe8d.diff
LOG: [libcxx] Add an explicit option to build against system-libcxxabi
Add an explicit LIBCXX_CXX_ABI=system-libcxxabi option for linking to
system-installed libc++abi. This fixes the ability to link against one
when building libcxx via the runtimes build, as otherwise the build
system insists on linking into in-tree targets.
Differential Revision: https://reviews.llvm.org/D119539
(cherry picked from commit ba4f1e44e480d661d99973007a39dc642f5d79a4)
Added:
Modified:
libcxx/cmake/Modules/HandleLibCXXABI.cmake
libcxx/docs/BuildingLibcxx.rst
libcxx/utils/libcxx/test/config.py
Removed:
diff --git a/libcxx/cmake/Modules/HandleLibCXXABI.cmake
b/libcxx/cmake/Modules/HandleLibCXXABI.cmake
index d69405ddeeacf..9b5df6e015b35 100644
--- a/libcxx/cmake/Modules/HandleLibCXXABI.cmake
+++ b/libcxx/cmake/Modules/HandleLibCXXABI.cmake
@@ -118,6 +118,10 @@ elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi")
setup_abi_lib(
"-DLIBCXX_BUILDING_LIBCXXABI"
"${shared}" "${static}" "cxxabi.h;__cxxabi_config.h" "")
+elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "system-libcxxabi")
+ setup_abi_lib(
+"-DLIBCXX_BUILDING_LIBCXXABI"
+"c++abi" "c++abi" "cxxabi.h;__cxxabi_config.h" "")
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
if(NOT LIBCXX_CXX_ABI_INCLUDE_PATHS)
set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1")
diff --git a/libcxx/docs/BuildingLibcxx.rst b/libcxx/docs/BuildingLibcxx.rst
index a0c7672ff7717..544d06cc8c424 100644
--- a/libcxx/docs/BuildingLibcxx.rst
+++ b/libcxx/docs/BuildingLibcxx.rst
@@ -318,7 +318,7 @@ ABI Library Specific Options
.. option:: LIBCXX_CXX_ABI:STRING
- **Values**: ``none``, ``libcxxabi``, ``libcxxrt``, ``libstdc++``,
``libsupc++``.
+ **Values**: ``none``, ``libcxxabi``, ``system-libcxxabi``, ``libcxxrt``,
``libstdc++``, ``libsupc++``.
Select the ABI library to build libc++ against.
diff --git a/libcxx/utils/libcxx/test/config.py
b/libcxx/utils/libcxx/test/config.py
index fdc1ff4f714ab..152a9755206e1 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -410,6 +410,8 @@ def configure_link_flags_abi_library(self):
self.cxx.link_flags += [abs_path]
else:
self.cxx.link_flags += ['-lc++abi']
+elif cxx_abi == 'system-libcxxabi':
+self.cxx.link_flags += ['-lc++abi']
elif cxx_abi == 'libcxxrt':
self.cxx.link_flags += ['-lcxxrt']
elif cxx_abi == 'vcruntime':
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] f58ab32 - [Attributor][FIX] Pipe UsedAssumedInformation through more interfaces
Author: Johannes Doerfert
Date: 2022-03-01T14:13:33-08:00
New Revision: f58ab32850211621d5986da2d687be0d550e7140
URL:
https://github.com/llvm/llvm-project/commit/f58ab32850211621d5986da2d687be0d550e7140
DIFF:
https://github.com/llvm/llvm-project/commit/f58ab32850211621d5986da2d687be0d550e7140.diff
LOG: [Attributor][FIX] Pipe UsedAssumedInformation through more interfaces
`UsedAssumedInformation` is a return argument utilized to determine what
information is known. Most APIs used it already but
`genericValueTraversal` did not. This adds it to `genericValueTraversal`
and replaces `AllCallSitesKnown` of `checkForAllCallSites` with the
commonly used `UsedAssumedInformation`.
This was supposed to be a NFC commit, then the test change appeared.
Turns out, we had one user of `AllCallSitesKnown` (AANoReturn) and the
way we set `AllCallSitesKnown` was wrong as we ignored the fact some
call sites were optimistically assumed dead. Included a dedicated test
for this as well now.
Fixes https://github.com/llvm/llvm-project/issues/53884
Added:
Modified:
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Transforms/Attributor/norecurse.ll
llvm/test/Transforms/OpenMP/custom_state_machines.ll
Removed:
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h
b/llvm/include/llvm/Transforms/IPO/Attributor.h
index 7eee16f71d64a..8677a0ba62f2a 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -192,6 +192,7 @@ bool getAssumedUnderlyingObjects(Attributor &A, const Value
&Ptr,
SmallVectorImpl &Objects,
const AbstractAttribute &QueryingAA,
const Instruction *CtxI,
+ bool &UsedAssumedInformation,
bool Intraprocedural = false);
/// Collect all potential values of the one stored by \p SI into
@@ -1824,23 +1825,24 @@ struct Attributor {
/// This method will evaluate \p Pred on call sites and return
/// true if \p Pred holds in every call sites. However, this is only possible
/// all call sites are known, hence the function has internal linkage.
- /// If true is returned, \p AllCallSitesKnown is set if all possible call
- /// sites of the function have been visited.
+ /// If true is returned, \p UsedAssumedInformation is set if assumed
+ /// information was used to skip or simplify potential call sites.
bool checkForAllCallSites(function_ref Pred,
const AbstractAttribute &QueryingAA,
-bool RequireAllCallSites, bool &AllCallSitesKnown);
+bool RequireAllCallSites,
+bool &UsedAssumedInformation);
/// Check \p Pred on all call sites of \p Fn.
///
/// This method will evaluate \p Pred on call sites and return
/// true if \p Pred holds in every call sites. However, this is only possible
/// all call sites are known, hence the function has internal linkage.
- /// If true is returned, \p AllCallSitesKnown is set if all possible call
- /// sites of the function have been visited.
+ /// If true is returned, \p UsedAssumedInformation is set if assumed
+ /// information was used to skip or simplify potential call sites.
bool checkForAllCallSites(function_ref Pred,
const Function &Fn, bool RequireAllCallSites,
const AbstractAttribute *QueryingAA,
-bool &AllCallSitesKnown);
+bool &UsedAssumedInformation);
/// Check \p Pred on all values potentially returned by \p F.
///
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp
b/llvm/lib/Transforms/IPO/Attributor.cpp
index d66140a726f69..7bca2084c448d 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -320,7 +320,8 @@ bool AA::getPotentialCopiesOfStoredValue(
Value &Ptr = *SI.getPointerOperand();
SmallVector Objects;
- if (!AA::getAssumedUnderlyingObjects(A, Ptr, Objects, QueryingAA, &SI)) {
+ if (!AA::getAssumedUnderlyingObjects(A, Ptr, Objects, QueryingAA, &SI,
+ UsedAssumedInformation)) {
LLVM_DEBUG(
dbgs() << "Underlying objects stored into could not be determined\n";);
return false;
@@ -514,10 +515,10 @@ isPotentiallyReachable(Attributor &A, const Instruction
&FromI,
return true;
};
-bool AllCallSitesKnown;
+bool UsedAssumedInformation = false;
Result = !A.checkForAllCallSites(CheckCallSite, *FromFn,
/* RequireAllCallSites */ true,
- &QueryingAA, AllCallSitesKnown)
[llvm-branch-commits] [llvm] d245bcf - [Mangler] Mangle aliases to fastcall/vectorcall functions correctly
Author: Amanieu d'Antras
Date: 2022-03-01T14:20:23-08:00
New Revision: d245bcf536a36430a0354bd90a7ef00c39ccbcb1
URL:
https://github.com/llvm/llvm-project/commit/d245bcf536a36430a0354bd90a7ef00c39ccbcb1
DIFF:
https://github.com/llvm/llvm-project/commit/d245bcf536a36430a0354bd90a7ef00c39ccbcb1.diff
LOG: [Mangler] Mangle aliases to fastcall/vectorcall functions correctly
These aliases are produced by MergeFunctions and need to be mangled according
to the calling convention of the function they are pointing to instead of
defaulting to the C calling convention.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D120382
(cherry picked from commit 54b909de682bfa4e3389b680b0916ab18c99952a)
Added:
Modified:
llvm/lib/IR/Mangler.cpp
llvm/test/CodeGen/X86/fastcall-correct-mangling.ll
Removed:
diff --git a/llvm/lib/IR/Mangler.cpp b/llvm/lib/IR/Mangler.cpp
index 2399ea27ee9d4..b8e3e40e4c1d5 100644
--- a/llvm/lib/IR/Mangler.cpp
+++ b/llvm/lib/IR/Mangler.cpp
@@ -144,7 +144,7 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const
GlobalValue *GV,
// Mangle functions with Microsoft calling conventions specially. Only do
// this mangling for x86_64 vectorcall and 32-bit x86.
- const Function *MSFunc = dyn_cast(GV);
+ const Function *MSFunc = dyn_cast_or_null(GV->getAliaseeObject());
// Don't add byte count suffixes when '\01' or '?' are in the first
// character.
diff --git a/llvm/test/CodeGen/X86/fastcall-correct-mangling.ll
b/llvm/test/CodeGen/X86/fastcall-correct-mangling.ll
index 00dc44e75e8f5..dd8ce0f0ef505 100644
--- a/llvm/test/CodeGen/X86/fastcall-correct-mangling.ll
+++ b/llvm/test/CodeGen/X86/fastcall-correct-mangling.ll
@@ -31,3 +31,7 @@ define private x86_fastcallcc void @dontCrash() {
; CHECK64-LABEL: {{^}}.LdontCrash:
ret void
}
+
+@alias = alias void(i64, i8, i8, i16), void(i64, i8, i8, i16)* @func
+; CHECK32-LABEL: {{^}}.set @alias@20, @func@20
+; CHECK64-LABEL: {{^}}.set alias, func
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] 3001b0d - [fir] Fix FlangOptimizerTests link on Solaris
Author: Rainer Orth
Date: 2022-03-01T14:22:00-08:00
New Revision: 3001b0d519630e2f1f0e2c4710379b3dbb43b715
URL:
https://github.com/llvm/llvm-project/commit/3001b0d519630e2f1f0e2c4710379b3dbb43b715
DIFF:
https://github.com/llvm/llvm-project/commit/3001b0d519630e2f1f0e2c4710379b3dbb43b715.diff
LOG: [fir] Fix FlangOptimizerTests link on Solaris
As reported in Issue #53690,
`tools/flang/unittests/Optimizer/FlangOptimizerTests` `FAIL`s to link on
Solaris:
Undefined first referenced
symbol in file
_ZN3fir7runtimeL8getModelIcEEPFN4mlir4TypeEPNS2_11MLIRContextEEv
lib/libFIRBuilder.a(Reduction.cpp.o)
which is `mlir::Type (*fir::runtime::getModel())(mlir::MLIRContext*)`.
`clang++` warn's
In file included from
/var/llvm/llvm-14.0.0-rc1/rc1/llvm-project/flang/lib/Optimizer/Builder/Runtime/Reduction.cpp:14:
/var/llvm/llvm-14.0.0-rc1/rc1/llvm-project/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h:60:34:
warning: function 'fir::runtime::getModel' has internal linkage but is
not defined [-Wundefined-internal]
static constexpr TypeBuilderFunc getModel();
^
/var/llvm/llvm-14.0.0-rc1/rc1/llvm-project/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h:289:29:
note: used here
TypeBuilderFunc ret = getModel();
^
Fixed by adding an explicit template instantiation for `getModel`. I
suppose this is necessary because on Solaris `char` is `signed`.
Tested on `sparcv9-sun-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D119438
(cherry picked from commit c2b9e9674d5259c12a055055f4e06eba5b8d0fa6)
Added:
Modified:
flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h
Removed:
diff --git a/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h
b/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h
index 072e3f26a49b..8fea99e00873 100644
--- a/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h
+++ b/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h
@@ -100,6 +100,12 @@ constexpr TypeBuilderFunc getModel() {
};
}
template <>
+constexpr TypeBuilderFunc getModel() {
+ return [](mlir::MLIRContext *context) -> mlir::Type {
+return mlir::IntegerType::get(context, 8 * sizeof(char));
+ };
+}
+template <>
constexpr TypeBuilderFunc getModel() {
return [](mlir::MLIRContext *context) -> mlir::Type {
return mlir::IntegerType::get(context, 8 * sizeof(signed char));
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 41d4f89 - [X86ISelLowering] permit BlockAddressSDNode "i" constraints for PIC
Author: Nick Desaulniers
Date: 2022-03-01T14:21:33-08:00
New Revision: 41d4f89e38b718b3a291fb24ff0e2b654ee1ff79
URL:
https://github.com/llvm/llvm-project/commit/41d4f89e38b718b3a291fb24ff0e2b654ee1ff79
DIFF:
https://github.com/llvm/llvm-project/commit/41d4f89e38b718b3a291fb24ff0e2b654ee1ff79.diff
LOG: [X86ISelLowering] permit BlockAddressSDNode "i" constraints for PIC
When building 32b x86 code as PIC, the existing handling of "i"
constraints is conservative since generally we have to go through the
GOT to find references to functions.
But generally, BlockAddresses from C code refer to the Function in the
current TU. Permit BlockAddresses to be used with the "i" constraint
for those cases.
I regressed this in
commit 4edb9983cb8c ("[SelectionDAG] treat X constrained labels as i for asm")
Fixes: https://github.com/llvm/llvm-project/issues/53868
Reviewed By: efriedma, MaskRay
Differential Revision: https://reviews.llvm.org/D119905
(cherry picked from commit 027c16bef4b727095eea00bbef9266f1f4a78c27)
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/inline-asm-pic.ll
Removed:
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp
b/llvm/lib/Target/X86/X86ISelLowering.cpp
index a1c387574ebb..77c2e7d16990 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -54599,8 +54599,9 @@ void
X86TargetLowering::LowerAsmOperandForConstraint(SDValue Op,
// In any sort of PIC mode addresses need to be computed at runtime by
// adding in a register or some sort of table lookup. These can't
-// be used as immediates.
-if (Subtarget.isPICStyleGOT() || Subtarget.isPICStyleStubPIC())
+// be used as immediates. BlockAddresses are fine though.
+if ((Subtarget.isPICStyleGOT() || Subtarget.isPICStyleStubPIC()) &&
+!isa(Op))
return;
// If we are in non-pic codegen mode, we allow the address of a global
(with
diff --git a/llvm/test/CodeGen/X86/inline-asm-pic.ll
b/llvm/test/CodeGen/X86/inline-asm-pic.ll
index 7aeb1bfbdf41..503f8db91a29 100644
--- a/llvm/test/CodeGen/X86/inline-asm-pic.ll
+++ b/llvm/test/CodeGen/X86/inline-asm-pic.ll
@@ -18,3 +18,41 @@ entry:
tail call void asm "mov $1,%gs:$0",
"=*m,ri,~{dirflag},~{fpsr},~{flags}"(i8** elementtype(i8*) inttoptr (i32 152 to
i8**), i8* bitcast (i8** @main_q to i8*)) nounwind
ret void
}
+
+; The intent of this test is to ensure that we handle blockaddress' correctly
+; with "i" constraints for -m32 -fPIC.
+
+define void @x() {
+; CHECK-LABEL: x:
+; CHECK: ## %bb.0:
+; CHECK-NEXT:## InlineAsm Start
+; CHECK-NEXT:## Ltmp0
+; CHECK-EMPTY:
+; CHECK-NEXT:## InlineAsm End
+; CHECK-NEXT: ## %bb.2: ## %return
+; CHECK-NEXT:retl
+; CHECK-NEXT: Ltmp0: ## Block address taken
+; CHECK-NEXT: LBB1_1: ## %overflow
+; CHECK-NEXT:retl
+ callbr void asm "# ${0:l}\0A", "i"(i8* blockaddress(@x, %overflow))
+ to label %return [label %overflow]
+
+overflow:
+ br label %return
+
+return:
+ ret void
+}
+
+; Test unusual case of blockaddress from @x in @y's asm.
+define void @y() {
+; CHECK-LABEL: y:
+; CHECK: ## %bb.0:
+; CHECK-NEXT:## InlineAsm Start
+; CHECK-NEXT:## Ltmp0
+; CHECK-EMPTY:
+; CHECK-NEXT:## InlineAsm End
+; CHECK-NEXT:retl
+ call void asm "# ${0:l}\0A", "i"(i8* blockaddress(@x, %overflow))
+ ret void
+}
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 1914953 - [BPF] Fix a BTF type pruning bug
Author: Yonghong Song
Date: 2022-03-01T14:30:33-08:00
New Revision: 19149538e9a9fce91bcdf70b69dc6defc9e8a533
URL:
https://github.com/llvm/llvm-project/commit/19149538e9a9fce91bcdf70b69dc6defc9e8a533
DIFF:
https://github.com/llvm/llvm-project/commit/19149538e9a9fce91bcdf70b69dc6defc9e8a533.diff
LOG: [BPF] Fix a BTF type pruning bug
In BPF backend, BTF type generation may skip
some debuginfo types if they are the pointee
type of a struct member. For example,
struct task_struct {
...
struct mm_struct*mm;
...
};
BPF backend may generate a forward decl for
'struct mm_struct' instead of full type if
there are no other usage of 'struct mm_struct'.
The reason is to avoid bringing too much unneeded types
in BTF.
Alexei found a pruning bug where we may miss
some full type generation. The following is an illustrating
example:
struct t1 { ... }
struct t2 { struct t1 *p; };
struct t2 g;
void foo(struct t1 *arg) { ... }
In the above case, we will have partial debuginfo chain like below:
struct t2 -> member p
\ -> ptr -> struct t1
/
foo -> argument arg
During traversing
struct t2 -> member p -> ptr -> struct t1
The corresponding BTF types are generated except 'struct t1' which
will be in FixUp stage. Later, when traversing
foo -> argument arg -> ptr -> struct t1
The 'ptr' BTF type has been generated and currently implementation
ignores 'pointer' type hence 'struct t1' is not generated.
This patch fixed the issue not just for the above case, but for
general case with multiple derived types, e.g.,
struct t2 -> member p
\ -> const -> ptr -> volatile -> struct t1
/
foo -> argument arg
Differential Revision: https://reviews.llvm.org/D119986
Added:
llvm/test/CodeGen/BPF/BTF/pruning-multi-derived-type.ll
Modified:
llvm/lib/Target/BPF/BTFDebug.cpp
Removed:
diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp
b/llvm/lib/Target/BPF/BTFDebug.cpp
index d536aed1d2114..166b62bd62269 100644
--- a/llvm/lib/Target/BPF/BTFDebug.cpp
+++ b/llvm/lib/Target/BPF/BTFDebug.cpp
@@ -773,15 +773,31 @@ void BTFDebug::visitTypeEntry(const DIType *Ty, uint32_t
&TypeId,
// already defined, we should keep moving to eventually
// bring in types for "struct t". Otherwise, the "struct s2"
// definition won't be correct.
+//
+// In the above, we have following debuginfo:
+// {ptr, struct_member} -> typedef -> struct
+// and BTF type for 'typedef' is generated while 'struct' may
+// be in FixUp. But let us generalize the above to handle
+// {
diff erent types} -> [various derived types]+ -> another type.
+// For example,
+// {func_param, struct_member} -> const -> ptr -> volatile -> struct
+// We will traverse const/ptr/volatile which already have corresponding
+// BTF types and generate type for 'struct' which might be in Fixup
+// state.
if (Ty && (!CheckPointer || !SeenPointer)) {
if (const auto *DTy = dyn_cast(Ty)) {
-unsigned Tag = DTy->getTag();
-if (Tag == dwarf::DW_TAG_typedef || Tag == dwarf::DW_TAG_const_type ||
-Tag == dwarf::DW_TAG_volatile_type ||
-Tag == dwarf::DW_TAG_restrict_type) {
- uint32_t TmpTypeId;
- visitTypeEntry(DTy->getBaseType(), TmpTypeId, CheckPointer,
- SeenPointer);
+while (DTy) {
+ const DIType *BaseTy = DTy->getBaseType();
+ if (!BaseTy)
+break;
+
+ if (DIToIdMap.find(BaseTy) != DIToIdMap.end()) {
+DTy = dyn_cast(BaseTy);
+ } else {
+uint32_t TmpTypeId;
+visitTypeEntry(BaseTy, TmpTypeId, CheckPointer, SeenPointer);
+break;
+ }
}
}
}
diff --git a/llvm/test/CodeGen/BPF/BTF/pruning-multi-derived-type.ll
b/llvm/test/CodeGen/BPF/BTF/pruning-multi-derived-type.ll
new file mode 100644
index 0..63c864fd0e3a8
--- /dev/null
+++ b/llvm/test/CodeGen/BPF/BTF/pruning-multi-derived-type.ll
@@ -0,0 +1,87 @@
+; RUN: llc -march=bpfel -filetype=asm -o - %s | FileCheck
-check-prefixes=CHECK %s
+; RUN: llc -march=bpfeb -filetype=asm -o - %s | FileCheck
-check-prefixes=CHECK %s
+; Source:
+; struct t1 {
+; int a;
+; };
+; struct t2 {
+; const struct t1 * const a;
+; };
+; int foo(struct t2 *arg) { return 0; }
+; int bar(const struct t1 * const arg) { return 0; }
+; Compilation flags:
+; clang -target bpf -O2 -g -S -emit-llvm t.c
+
+%struct.t2 = type { %struct.t1* }
+%struct.t1 = type { i32 }
+
+; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone
willreturn
+define dso_local i32 @foo(%struct.t2* nocapture noundef readnone %arg)
local_unnamed_addr #0 !dbg !7 {
+entry:
+ call void @llvm.dbg.value(metadata %struct.t2* %arg, metadata !22, me
[llvm-branch-commits] [llvm] da33d40 - [SLP] Don't try to vectorize pair with insertelement
Author: Anton Afanasyev
Date: 2022-03-01T14:29:22-08:00
New Revision: da33d400682a8cf93062fe61a9f0b6ec1d60c8ad
URL:
https://github.com/llvm/llvm-project/commit/da33d400682a8cf93062fe61a9f0b6ec1d60c8ad
DIFF:
https://github.com/llvm/llvm-project/commit/da33d400682a8cf93062fe61a9f0b6ec1d60c8ad.diff
LOG: [SLP] Don't try to vectorize pair with insertelement
Particularly this breaks vectorization of insertelements where some of
intermediate (i.e. not last) insertelements are used externally.
Fixes PR52275
Fixes #51617
Reviewed by: ABataev
Differential Revision: https://reviews.llvm.org/D119679
(cherry picked from commit b7574b0)
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/X86/pr52275.ll
Removed:
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 9eafd94efea28..644372483edde 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -3849,13 +3849,7 @@ void BoUpSLP::buildTree_rec(ArrayRef VL,
unsigned Depth,
ValueSet SourceVectors;
for (Value *V : VL) {
SourceVectors.insert(cast(V)->getOperand(0));
-if (getInsertIndex(V) == None) {
- LLVM_DEBUG(dbgs() << "SLP: Gather of insertelement vectors with "
- "non-constant or undef index.\n");
- newTreeEntry(VL, None /*not vectorized*/, S, UserTreeIdx);
- BS.cancelScheduling(VL, VL0);
- return;
-}
+assert(getInsertIndex(V) != None && "Non-constant or undef index?");
}
if (count_if(VL, [&SourceVectors](Value *V) {
@@ -8343,6 +8337,8 @@ void
SLPVectorizerPass::collectSeedInstructions(BasicBlock *BB) {
bool SLPVectorizerPass::tryToVectorizePair(Value *A, Value *B, BoUpSLP &R) {
if (!A || !B)
return false;
+ if (isa(A) || isa(B))
+return false;
Value *VL[] = {A, B};
return tryToVectorizeList(VL, R);
}
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/pr52275.ll
b/llvm/test/Transforms/SLPVectorizer/X86/pr52275.ll
index 6794553ffd6d0..9205ef0b375d1 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/pr52275.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/pr52275.ll
@@ -1,16 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -slp-vectorizer -S -mtriple=x86_64-- | FileCheck %s
-define <4 x i8> @pr52275(<4 x i8> %v, i8* %x) {
-; CHECK-LABEL: @pr52275(
-; CHECK-NEXT:[[G1:%.*]] = getelementptr inbounds i8, i8* [[X:%.*]], i64 1
-; CHECK-NEXT:[[TMP1:%.*]] = bitcast i8* [[X]] to <2 x i8>*
-; CHECK-NEXT:[[TMP2:%.*]] = load <2 x i8>, <2 x i8>* [[TMP1]], align 4
-; CHECK-NEXT:[[TMP3:%.*]] = shufflevector <2 x i8> [[TMP2]], <2 x i8>
poison, <4 x i32>
-; CHECK-NEXT:[[V11:%.*]] = shufflevector <4 x i8> [[V:%.*]], <4 x i8>
[[TMP3]], <4 x i32>
-; CHECK-NEXT:[[V2:%.*]] = add <4 x i8> [[V11]], [[V11]]
-; CHECK-NEXT:ret <4 x i8> [[V2]]
-;
+define <4 x i8> @test(<4 x i8> %v, i8* %x) {
%x0 = load i8, i8* %x, align 4
%g1 = getelementptr inbounds i8, i8* %x, i64 1
%x1 = load i8, i8* %g1, align 4
@@ -19,3 +10,139 @@ define <4 x i8> @pr52275(<4 x i8> %v, i8* %x) {
%v2 = add <4 x i8> %v0, %v1
ret <4 x i8> %v2
}
+
+define <2 x i8> @test2(<2 x i8> %t6, i32* %t1) {
+; CHECK-LABEL: @test2(
+; CHECK-NEXT:[[T3:%.*]] = load i32, i32* [[T1:%.*]], align 4
+; CHECK-NEXT:[[T4:%.*]] = getelementptr inbounds i32, i32* [[T1]], i64 1
+; CHECK-NEXT:[[T5:%.*]] = load i32, i32* [[T4]], align 4
+; CHECK-NEXT:[[T7:%.*]] = trunc i32 [[T3]] to i8
+; CHECK-NEXT:[[T8:%.*]] = insertelement <2 x i8> [[T6:%.*]], i8 [[T7]],
i64 0
+; CHECK-NEXT:[[T9:%.*]] = trunc i32 [[T5]] to i8
+; CHECK-NEXT:[[T10:%.*]] = insertelement <2 x i8> [[T8]], i8 [[T9]], i64 1
+; CHECK-NEXT:[[T11:%.*]] = add <2 x i8> [[T10]], [[T8]]
+; CHECK-NEXT:ret <2 x i8> [[T11]]
+;
+; FORCE_SLP-LABEL: @test2(
+; FORCE_SLP-NEXT:[[T3:%.*]] = load i32, i32* [[T1:%.*]], align 4
+; FORCE_SLP-NEXT:[[T4:%.*]] = getelementptr inbounds i32, i32* [[T1]], i64
1
+; FORCE_SLP-NEXT:[[T5:%.*]] = load i32, i32* [[T4]], align 4
+; FORCE_SLP-NEXT:[[T7:%.*]] = trunc i32 [[T3]] to i8
+; FORCE_SLP-NEXT:[[T8:%.*]] = insertelement <2 x i8> [[T6:%.*]], i8
[[T7]], i64 0
+; FORCE_SLP-NEXT:[[T9:%.*]] = trunc i32 [[T5]] to i8
+; FORCE_SLP-NEXT:[[T10:%.*]] = insertelement <2 x i8> [[T8]], i8 [[T9]],
i64 1
+; FORCE_SLP-NEXT:[[T11:%.*]] = add <2 x i8> [[T10]], [[T8]]
+; FORCE_SLP-NEXT:ret <2 x i8> [[T11]]
+;
+ %t3 = load i32, i32* %t1, align 4
+ %t4 = getelementptr inbounds i32, i32* %t1, i64 1
+ %t5 = load i32, i32* %t4, align 4
+ %t7 = trunc i32 %t3 to i8
+ %t8 = insertelement <2 x i8> %t6, i8 %t7, i64 0
+ %t9 = trunc i32 %t5 to i8
+ %t10 = insertelement <2 x i8>
[llvm-branch-commits] [llvm] ce3d57a - Revert "[BPF] Fix a BTF type pruning bug"
Author: Tom Stellard
Date: 2022-03-01T16:42:37-08:00
New Revision: ce3d57ad61db88beba0126cade242c0c3ddc4cf5
URL:
https://github.com/llvm/llvm-project/commit/ce3d57ad61db88beba0126cade242c0c3ddc4cf5
DIFF:
https://github.com/llvm/llvm-project/commit/ce3d57ad61db88beba0126cade242c0c3ddc4cf5.diff
LOG: Revert "[BPF] Fix a BTF type pruning bug"
This reverts commit 19149538e9a9fce91bcdf70b69dc6defc9e8a533.
This fix was accidentally committed.
Added:
Modified:
llvm/lib/Target/BPF/BTFDebug.cpp
Removed:
llvm/test/CodeGen/BPF/BTF/pruning-multi-derived-type.ll
diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp
b/llvm/lib/Target/BPF/BTFDebug.cpp
index 166b62bd62269..d536aed1d2114 100644
--- a/llvm/lib/Target/BPF/BTFDebug.cpp
+++ b/llvm/lib/Target/BPF/BTFDebug.cpp
@@ -773,31 +773,15 @@ void BTFDebug::visitTypeEntry(const DIType *Ty, uint32_t
&TypeId,
// already defined, we should keep moving to eventually
// bring in types for "struct t". Otherwise, the "struct s2"
// definition won't be correct.
-//
-// In the above, we have following debuginfo:
-// {ptr, struct_member} -> typedef -> struct
-// and BTF type for 'typedef' is generated while 'struct' may
-// be in FixUp. But let us generalize the above to handle
-// {
diff erent types} -> [various derived types]+ -> another type.
-// For example,
-// {func_param, struct_member} -> const -> ptr -> volatile -> struct
-// We will traverse const/ptr/volatile which already have corresponding
-// BTF types and generate type for 'struct' which might be in Fixup
-// state.
if (Ty && (!CheckPointer || !SeenPointer)) {
if (const auto *DTy = dyn_cast(Ty)) {
-while (DTy) {
- const DIType *BaseTy = DTy->getBaseType();
- if (!BaseTy)
-break;
-
- if (DIToIdMap.find(BaseTy) != DIToIdMap.end()) {
-DTy = dyn_cast(BaseTy);
- } else {
-uint32_t TmpTypeId;
-visitTypeEntry(BaseTy, TmpTypeId, CheckPointer, SeenPointer);
-break;
- }
+unsigned Tag = DTy->getTag();
+if (Tag == dwarf::DW_TAG_typedef || Tag == dwarf::DW_TAG_const_type ||
+Tag == dwarf::DW_TAG_volatile_type ||
+Tag == dwarf::DW_TAG_restrict_type) {
+ uint32_t TmpTypeId;
+ visitTypeEntry(DTy->getBaseType(), TmpTypeId, CheckPointer,
+ SeenPointer);
}
}
}
diff --git a/llvm/test/CodeGen/BPF/BTF/pruning-multi-derived-type.ll
b/llvm/test/CodeGen/BPF/BTF/pruning-multi-derived-type.ll
deleted file mode 100644
index 63c864fd0e3a8..0
--- a/llvm/test/CodeGen/BPF/BTF/pruning-multi-derived-type.ll
+++ /dev/null
@@ -1,87 +0,0 @@
-; RUN: llc -march=bpfel -filetype=asm -o - %s | FileCheck
-check-prefixes=CHECK %s
-; RUN: llc -march=bpfeb -filetype=asm -o - %s | FileCheck
-check-prefixes=CHECK %s
-; Source:
-; struct t1 {
-; int a;
-; };
-; struct t2 {
-; const struct t1 * const a;
-; };
-; int foo(struct t2 *arg) { return 0; }
-; int bar(const struct t1 * const arg) { return 0; }
-; Compilation flags:
-; clang -target bpf -O2 -g -S -emit-llvm t.c
-
-%struct.t2 = type { %struct.t1* }
-%struct.t1 = type { i32 }
-
-; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone
willreturn
-define dso_local i32 @foo(%struct.t2* nocapture noundef readnone %arg)
local_unnamed_addr #0 !dbg !7 {
-entry:
- call void @llvm.dbg.value(metadata %struct.t2* %arg, metadata !22, metadata
!DIExpression()), !dbg !23
- ret i32 0, !dbg !24
-}
-
-; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone
willreturn
-define dso_local i32 @bar(%struct.t1* nocapture noundef readnone %arg)
local_unnamed_addr #0 !dbg !25 {
-entry:
- call void @llvm.dbg.value(metadata %struct.t1* %arg, metadata !29, metadata
!DIExpression()), !dbg !30
- ret i32 0, !dbg !31
-}
-
-; CHECK: .long 10 # BTF_KIND_INT(id
= 7)
-; CHECK-NEXT:.long 16777216# 0x100
-; CHECK-NEXT:.long 4
-; CHECK-NEXT:.long 16777248# 0x120
-
-; CHECK: .long 69 #
BTF_KIND_STRUCT(id = 9)
-; CHECK-NEXT:.long 67108865# 0x401
-; CHECK-NEXT:.long 4
-; CHECK-NEXT:.long 4
-; CHECK-NEXT:.long 7
-
-; CHECK: .byte 97 # string offset=4
-; CHECK: .ascii "t1"# string offset=69
-
-; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
-declare void @llvm.dbg.value(metadata, metadata, metadata) #1
-
-attributes #0 = { mustprogress nofree norecurse nosync nounwind readnone
willreturn "frame-pointer"="all" "min-legal-vector-width"="0"
"
[llvm-branch-commits] [llvm] 4c9110a - [MIPS] Recognize DT_MIPS_XHASH dynamic table tag
Author: Simon Atanasyan
Date: 2022-03-01T16:46:37-08:00
New Revision: 4c9110a5f37b99d831887ebc1365cec7c3281f36
URL:
https://github.com/llvm/llvm-project/commit/4c9110a5f37b99d831887ebc1365cec7c3281f36
DIFF:
https://github.com/llvm/llvm-project/commit/4c9110a5f37b99d831887ebc1365cec7c3281f36.diff
LOG: [MIPS] Recognize DT_MIPS_XHASH dynamic table tag
LLVM tools do not emit `DT_MIPS_XHASH` dynamic table tag. But now
`llvm-objdump` and `llvm-readelf` recognize this tag and print it.
Fixes https://github.com/llvm/llvm-project/issues/53996
(cherry picked from commit 3c840e3c00e910c47a3f61f755fdc402d51e9fb6)
Added:
Modified:
llvm/include/llvm/BinaryFormat/DynamicTags.def
llvm/test/tools/llvm-objdump/ELF/dynamic-section-machine-specific.test
llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test
llvm/test/tools/obj2yaml/ELF/dynamic-section-arch-tags.yaml
llvm/tools/llvm-readobj/ELFDumper.cpp
Removed:
diff --git a/llvm/include/llvm/BinaryFormat/DynamicTags.def
b/llvm/include/llvm/BinaryFormat/DynamicTags.def
index 814d8b113ec4e..ae25ec53813c7 100644
--- a/llvm/include/llvm/BinaryFormat/DynamicTags.def
+++ b/llvm/include/llvm/BinaryFormat/DynamicTags.def
@@ -209,6 +209,7 @@ MIPS_DYNAMIC_TAG(MIPS_RWPLT, 0x7034)// Points
to the base
// of a writable PLT.
MIPS_DYNAMIC_TAG(MIPS_RLD_MAP_REL, 0x7035) // Relative offset of run time
loader
// map, used for debugging.
+MIPS_DYNAMIC_TAG(MIPS_XHASH, 0x7036)// GNU-style hash table with
xlat.
// PPC specific dynamic table entries.
PPC_DYNAMIC_TAG(PPC_GOT, 0x7000) // Uses Secure PLT ABI.
diff --git
a/llvm/test/tools/llvm-objdump/ELF/dynamic-section-machine-specific.test
b/llvm/test/tools/llvm-objdump/ELF/dynamic-section-machine-specific.test
index 08d7d2e9c7c73..20219dd4893b7 100644
--- a/llvm/test/tools/llvm-objdump/ELF/dynamic-section-machine-specific.test
+++ b/llvm/test/tools/llvm-objdump/ELF/dynamic-section-machine-specific.test
@@ -86,6 +86,7 @@ ProgramHeaders:
# MIPS-NEXT: MIPS_PLTGOT0x1000
# MIPS-NEXT: MIPS_RWPLT 0x1000
# MIPS-NEXT: MIPS_RLD_MAP_REL 0x1000
+# MIPS-NEXT: MIPS_XHASH 0x2000
--- !ELF
FileHeader:
@@ -187,6 +188,8 @@ Sections:
Value: 0x1000
- Tag: DT_MIPS_RLD_MAP_REL
Value: 0x1000
+ - Tag: DT_MIPS_XHASH
+Value: 0x2000
- Tag: DT_NULL
Value: 0
ProgramHeaders:
diff --git
a/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test
b/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test
index 970edccdd..c32ea33b9b3cb 100644
--- a/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test
+++ b/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test
@@ -53,7 +53,7 @@ ProgramHeaders:
# RUN: llvm-readelf --dynamic-table %t.mips \
# RUN: | FileCheck %s --strict-whitespace --match-full-lines
--check-prefix=GNU-MIPS
-# LLVM-MIPS:DynamicSection [ (47 entries)
+# LLVM-MIPS:DynamicSection [ (48 entries)
# LLVM-MIPS-NEXT: TagType Name/Value
# LLVM-MIPS-NEXT: 0x0004 HASH 0x1000
# LLVM-MIPS-NEXT: 0x7001 MIPS_RLD_VERSION 305419896
@@ -101,10 +101,11 @@ ProgramHeaders:
# LLVM-MIPS-NEXT: 0x7032 MIPS_PLTGOT0x1000
# LLVM-MIPS-NEXT: 0x7034 MIPS_RWPLT 0x1000
# LLVM-MIPS-NEXT: 0x7035 MIPS_RLD_MAP_REL 0x1000
+# LLVM-MIPS-NEXT: 0x7036 MIPS_XHASH 0x2000
# LLVM-MIPS-NEXT: 0x NULL 0x0
# LLVM-MIPS-NEXT:]
-# GNU-MIPS:Dynamic section at offset {{.*}} contains 47 entries:
+# GNU-MIPS:Dynamic section at offset {{.*}} contains 48 entries:
# GNU-MIPS-NEXT: TagType Name/Value
# GNU-MIPS-NEXT: 0x0004 (HASH) 0x1000
# GNU-MIPS-NEXT: 0x7001 (MIPS_RLD_VERSION) 305419896
@@ -152,6 +153,7 @@ ProgramHeaders:
# GNU-MIPS-NEXT: 0x7032 (MIPS_PLTGOT)0x1000
# GNU-MIPS-NEXT: 0x7034 (MIPS_RWPLT) 0x1000
# GNU-MIPS-NEXT: 0x7035 (MIPS_RLD_MAP_REL) 0x1000
+# GNU-MIPS-NEXT: 0x7036 (MIPS_XHASH) 0x2000
# GNU-MIPS-NEXT: 0x (NULL) 0x0
--- !ELF
@@ -256,6 +258,8 @@ Sections:
Value: 0x1000
- Tag: DT_MIPS_RLD_MAP_REL
Value: 0x1000
+ - Tag: DT_MIPS_XHASH
+Value: 0x2000
- Tag: DT_NULL
Value: 0
ProgramHeaders:
diff --git a/llvm/test
[llvm-branch-commits] [llvm] 967296b - [RISCV] Fix inline asm errors in zfinx
Author: Shao-Ce SUN
Date: 2022-03-02T14:31:23+08:00
New Revision: 967296bfefee9740b1dfb4644970d776e1b37b5b
URL:
https://github.com/llvm/llvm-project/commit/967296bfefee9740b1dfb4644970d776e1b37b5b
DIFF:
https://github.com/llvm/llvm-project/commit/967296bfefee9740b1dfb4644970d776e1b37b5b.diff
LOG: [RISCV] Fix inline asm errors in zfinx
Patch is from craig.topper's comments in https://reviews.llvm.org/D93298
Added:
llvm/test/CodeGen/RISCV/zfinx-types.ll
Modified:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Removed:
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 7fb9b7a85..19935caa34dfb 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -10466,7 +10466,29 @@
RISCVTargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
}
}
- return TargetLowering::getRegForInlineAsmConstraint(TRI, Constraint, VT);
+ std::pair Res =
+ TargetLowering::getRegForInlineAsmConstraint(TRI, Constraint, VT);
+
+ if (Res.second == &RISCV::GPRF32RegClass) {
+if (!Subtarget.is64Bit() || VT == MVT::Other)
+ return std::make_pair(Res.first, &RISCV::GPRRegClass);
+return std::make_pair(0, nullptr);
+ }
+
+ if (Res.second == &RISCV::GPRF64RegClass ||
+ Res.second == &RISCV::GPRPF64RegClass) {
+if (Subtarget.is64Bit() || VT == MVT::Other)
+ return std::make_pair(Res.first, &RISCV::GPRRegClass);
+return std::make_pair(0, nullptr);
+ }
+
+ if (Res.second == &RISCV::GPRF16RegClass) {
+if (VT == MVT::Other)
+ return std::make_pair(Res.first, &RISCV::GPRRegClass);
+return std::make_pair(0, nullptr);
+ }
+
+ return Res;
}
unsigned
diff --git a/llvm/test/CodeGen/RISCV/zfinx-types.ll
b/llvm/test/CodeGen/RISCV/zfinx-types.ll
new file mode 100644
index 0..9cbc7d9ce219b
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/zfinx-types.ll
@@ -0,0 +1,19 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \
+; RUN: -target-abi=ilp32f | FileCheck -check-prefix=RVZFINX %s
+; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \
+; RUN: -target-abi=lp64f | FileCheck -check-prefix=RVZFINX %s
+
+define float @test_float(float %x) {
+; RVZFINX-LABEL: test_float:
+; RVZFINX: # %bb.0:
+; RVZFINX-NEXT:.cfi_def_cfa_offset 0
+; RVZFINX-NEXT:li a0, 0
+; RVZFINX-NEXT:#APP
+; RVZFINX-NEXT:mv a0, a0
+; RVZFINX-NEXT:#NO_APP
+; RVZFINX-NEXT:li a0, 0
+; RVZFINX-NEXT:ret
+ %1 = tail call float asm sideeffect alignstack "mv a0, a0",
"={x10},{x10}"(float 0.00e+00)
+ ret float 0.00e+00
+}
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
