[llvm-branch-commits] [llvm] 197d9d9 - [AArch64][sve] Prevent incorrect function call on fixed width vector
Author: David Truby
Date: 2021-09-08T06:09:19-07:00
New Revision: 197d9d91aec1b817f093355760061d2673d96267
URL:
https://github.com/llvm/llvm-project/commit/197d9d91aec1b817f093355760061d2673d96267
DIFF:
https://github.com/llvm/llvm-project/commit/197d9d91aec1b817f093355760061d2673d96267.diff
LOG: [AArch64][sve] Prevent incorrect function call on fixed width vector
The isEssentiallyExtractHighSubvector function currently calls
getVectorNumElements on a type that in specific cases might be scalable.
Since this function only has correct behaviour at the moment on scalable
types anyway, the function can just return false when given a fixed type.
Differential Revision: https://reviews.llvm.org/D109163
(cherry picked from commit b297531ece896fb9ec36f001a74aef144082602b)
Added:
llvm/test/CodeGen/AArch64/sve-no-typesize-warnings.ll
Modified:
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
Removed:
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index b27a02b8c1828..60c00f47859b0 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -13680,6 +13680,8 @@ static bool isEssentiallyExtractHighSubvector(SDValue
N) {
N = N.getOperand(0);
if (N.getOpcode() != ISD::EXTRACT_SUBVECTOR)
return false;
+ if (N.getOperand(0).getValueType().isScalableVector())
+return false;
return cast(N.getOperand(1))->getAPIntValue() ==
N.getOperand(0).getValueType().getVectorNumElements() / 2;
}
diff --git a/llvm/test/CodeGen/AArch64/sve-no-typesize-warnings.ll
b/llvm/test/CodeGen/AArch64/sve-no-typesize-warnings.ll
new file mode 100644
index 0..3492d9a1636e7
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/sve-no-typesize-warnings.ll
@@ -0,0 +1,20 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s | FileCheck %s
+
+target triple = "aarch64-unknown-linux-gnu"
+
+define <4 x i32> @sve_no_typesize_warning( %a, <4 x i16> %b)
#0 {
+; CHECK-LABEL: sve_no_typesize_warning:
+; CHECK: // %bb.0:
+; CHECK-NEXT:uaddl v0.4s, v0.4h, v1.4h
+; CHECK-NEXT:ret
+%a.lo = call <4 x i16> @llvm.experimental.vector.extract.v4i16.nxv8i16( %a, i64 0)
+%a.lo.zext = zext <4 x i16> %a.lo to <4 x i32>
+%b.zext = zext <4 x i16> %b to <4 x i32>
+%add = add <4 x i32> %a.lo.zext, %b.zext
+ret <4 x i32> %add
+}
+
+declare <4 x i16> @llvm.experimental.vector.extract.v4i16.nxv8i16(, i64)
+
+attributes #0 = { "target-features"="+sve" }
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] b46abdb - [clang][Driver] Pick the last --driver-mode in case of multiple ones
Author: Kadir Cetinkaya
Date: 2021-09-08T06:11:16-07:00
New Revision: b46abdb7b8fe6294d4603fce173aba4e2b375dd0
URL:
https://github.com/llvm/llvm-project/commit/b46abdb7b8fe6294d4603fce173aba4e2b375dd0
DIFF:
https://github.com/llvm/llvm-project/commit/b46abdb7b8fe6294d4603fce173aba4e2b375dd0.diff
LOG: [clang][Driver] Pick the last --driver-mode in case of multiple ones
This was an accidental behaviour change in D106789 and this patch
restores it back to original state.
Differential Revision: https://reviews.llvm.org/D109361
(cherry picked from commit 73c00d40bd49ae022f6fbba7200f05facb533e3b)
Added:
Modified:
clang/lib/Driver/Driver.cpp
clang/unittests/Driver/ToolChainTest.cpp
Removed:
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 5c323cb6ea23e..94a7553e273ba 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -5568,7 +5568,6 @@ llvm::StringRef clang::driver::getDriverMode(StringRef
ProgName,
if (!Arg.startswith(OptName))
continue;
Opt = Arg;
-break;
}
if (Opt.empty())
Opt = ToolChain::getTargetAndModeFromProgramName(ProgName).DriverMode;
diff --git a/clang/unittests/Driver/ToolChainTest.cpp
b/clang/unittests/Driver/ToolChainTest.cpp
index 253c65d0e29fe..f117472957781 100644
--- a/clang/unittests/Driver/ToolChainTest.cpp
+++ b/clang/unittests/Driver/ToolChainTest.cpp
@@ -16,6 +16,7 @@
#include "clang/Basic/LLVM.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h"
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/VirtualFileSystem.h"
@@ -357,4 +358,10 @@ TEST(ToolChainTest, PostCallback) {
EXPECT_TRUE(CallbackHasCalled);
}
+TEST(GetDriverMode, PrefersLastDriverMode) {
+ static constexpr const char *Args[] = {"clang-cl", "--driver-mode=foo",
+ "--driver-mode=bar", "foo.cpp"};
+ EXPECT_EQ(getDriverMode(Args[0], llvm::makeArrayRef(Args).slice(1)), "bar");
+}
+
} // end anonymous namespace.
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 912ad58 - Add llvm-ml to LLVM_TOOLCHAIN_TOOLS (PR50536)
Author: Hans Wennborg Date: 2021-09-08T08:44:45-07:00 New Revision: 912ad5830cc10c77062887f9afd053451e8b14cb URL: https://github.com/llvm/llvm-project/commit/912ad5830cc10c77062887f9afd053451e8b14cb DIFF: https://github.com/llvm/llvm-project/commit/912ad5830cc10c77062887f9afd053451e8b14cb.diff LOG: Add llvm-ml to LLVM_TOOLCHAIN_TOOLS (PR50536) so that it gets installed in LLVM_INSTALL_TOOLCHAIN_ONLY builds, such as used by the Windows installer. Differential revision: https://reviews.llvm.org/D109358 (cherry picked from commit c364dcbf1fd81c6291e935564fce2d9ebb97a3d0) Added: Modified: llvm/cmake/modules/AddLLVM.cmake Removed: diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index 3e009f5061d3a..29e40f45fef89 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -1196,6 +1196,7 @@ if(NOT LLVM_TOOLCHAIN_TOOLS) llvm-cxxfilt llvm-ranlib llvm-lib +llvm-ml llvm-nm llvm-objcopy llvm-objdump ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] bc3cbd7 - [llvm-objdump] Fix 'llvm-objdump -dr' for executables with relocations
Author: Maksim Panchenko
Date: 2021-09-08T08:45:39-07:00
New Revision: bc3cbd744d70627a7a3e661467168e4b5d4b4bde
URL:
https://github.com/llvm/llvm-project/commit/bc3cbd744d70627a7a3e661467168e4b5d4b4bde
DIFF:
https://github.com/llvm/llvm-project/commit/bc3cbd744d70627a7a3e661467168e4b5d4b4bde.diff
LOG: [llvm-objdump] Fix 'llvm-objdump -dr' for executables with relocations
Print relocations interleaved with disassembled instructions for
executables with relocatable sections, e.g. those built with "-Wl,-q".
Differential Revision: https://reviews.llvm.org/D109016
(cherry picked from commit 6300e4ac5806c9255c68c6fada37b2ce70efc524)
Added:
llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs-exec.test
Modified:
llvm/tools/llvm-objdump/llvm-objdump.cpp
Removed:
diff --git a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs-exec.test
b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs-exec.test
new file mode 100644
index 0..16216c68e1b2c
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs-exec.test
@@ -0,0 +1,59 @@
+## Check that 'llvm-objdump -dr' correctly prints relocations in executables.
+
+# RUN: yaml2obj --docnum=1 %s -o %t
+# RUN: llvm-objdump -dr %t | FileCheck %s
+
+# CHECK: 40: 90nop
+# CHECK-NEXT: 41: bf 10 00 40 00movl$4194320, %edi
+# CHECK-NEXT:0042: R_X86_64_32 .rodata
+# CHECK-NEXT: 46: e8 fc fe ff ffcallq 0x3fff07
+# CHECK-NEXT:0047: R_X86_64_PLT32 puts-0x4
+# CHECK-NEXT: 4b: 90nop
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data:ELFDATA2LSB
+ Type:ET_EXEC
+ Machine: EM_X86_64
+ProgramHeaders:
+ - Type:PT_LOAD
+Flags: [ PF_X, PF_R ]
+FirstSec:.text
+LastSec: .rodata
+VAddr: 0x40
+Sections:
+ - Name:.text
+Type:SHT_PROGBITS
+Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+Address: 0x40
+AddressAlign:0x10
+Content: 90BF10004000E8FCFE90
+ - Name:.rodata
+Type:SHT_PROGBITS
+Flags: [ SHF_ALLOC ]
+AddressAlign:0x8
+Content: 00
+ - Name:.rela.text
+Type:SHT_RELA
+Flags: [ SHF_INFO_LINK ]
+AddressAlign:0x8
+Info:.text
+Relocations:
+ - Offset: 0x42
+Symbol: .rodata
+Type:R_X86_64_32
+Addend: 0
+ - Offset: 0x47
+Symbol: puts
+Type:R_X86_64_PLT32
+Addend: -4
+Symbols:
+ - Name:.rodata
+Type:STT_SECTION
+Section: .rodata
+Value: 0x400628
+ - Name:puts
+Type:STT_FUNC
+Binding: STB_GLOBAL
+...
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp
b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 48ae92f734c74..9d461b08f3f88 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -1286,6 +1286,10 @@ static void disassembleObject(const Target *TheTarget,
const ObjectFile *Obj,
if (shouldAdjustVA(Section))
VMAAdjustment = AdjustVMA;
+// In executable and shared objects, r_offset holds a virtual address.
+// Subtract SectionAddr from the r_offset field of a relocation to get
+// the section offset.
+uint64_t RelAdjustment = Obj->isRelocatableObject() ? 0 : SectionAddr;
uint64_t Size;
uint64_t Index;
bool PrintedSection = false;
@@ -1432,7 +1436,8 @@ static void disassembleObject(const Target *TheTarget,
const ObjectFile *Obj,
// For --reloc: print zero blocks patched by relocations, so that
// relocations can be shown in the dump.
if (RelCur != RelEnd)
- MaxOffset = RelCur->getOffset() - Index;
+ MaxOffset = std::min(RelCur->getOffset() - RelAdjustment - Index,
+ MaxOffset);
if (size_t N =
countSkippableZeroBytes(Bytes.slice(Index, MaxOffset))) {
@@ -1581,7 +1586,7 @@ static void disassembleObject(const Target *TheTarget,
const ObjectFile *Obj,
if (Obj->getArch() != Triple::hexagon) {
// Print relocation for instruction and data.
while (RelCur != RelEnd) {
-uint64_t Offset = RelCur->getOffset();
+uint64_t Offset = RelCur->getOffset() - RelAdjustment;
// If this relocation is hidden, skip it.
if (getHidden(*RelCur) || SectionAddr + Offset < StartAddress) {
++RelCur;
_
[llvm-branch-commits] [llvm] 297e923 - [SelectionDAGBuilder] Bugfix in visitInlineAsm()
Author: Jonas Paulsson
Date: 2021-09-08T14:03:50-07:00
New Revision: 297e9237db531a94ce024934c703a10656b4f781
URL:
https://github.com/llvm/llvm-project/commit/297e9237db531a94ce024934c703a10656b4f781
DIFF:
https://github.com/llvm/llvm-project/commit/297e9237db531a94ce024934c703a10656b4f781.diff
LOG: [SelectionDAGBuilder] Bugfix in visitInlineAsm()
In case of a virtual register tied to a phys-def, the register class needs to
be computed. Make sure that this works generally also with fast regalloc by
using TLI.getRegClassFor() whenever possible, and make only the case of
'Untyped' use getMinimalPhysRegClass().
Fixes https://bugs.llvm.org/show_bug.cgi?id=51699.
Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D109291
(cherry picked from commit 118997d8e931dcb4c6e972611a7e4febcc33a061)
Added:
llvm/test/CodeGen/X86/20210831-inlineasm.ll
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Removed:
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index a08548393979..bd2ebfd0bd3b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -8677,8 +8677,10 @@ void SelectionDAGBuilder::visitInlineAsm(const CallBase
&Call,
RegisterSDNode *R =
dyn_cast(AsmNodeOperands[CurOp+1]);
Register TiedReg = R->getReg();
MVT RegVT = R->getSimpleValueType(0);
- const TargetRegisterClass *RC = TiedReg.isVirtual() ?
-MRI.getRegClass(TiedReg) : TRI.getMinimalPhysRegClass(TiedReg);
+ const TargetRegisterClass *RC =
+ TiedReg.isVirtual() ? MRI.getRegClass(TiedReg)
+ : RegVT != MVT::Untyped ? TLI.getRegClassFor(RegVT)
+ : TRI.getMinimalPhysRegClass(TiedReg);
unsigned NumRegs = InlineAsm::getNumOperandRegisters(OpFlag);
for (unsigned i = 0; i != NumRegs; ++i)
Regs.push_back(MRI.createVirtualRegister(RC));
diff --git a/llvm/test/CodeGen/X86/20210831-inlineasm.ll
b/llvm/test/CodeGen/X86/20210831-inlineasm.ll
new file mode 100644
index ..065695db9e3c
--- /dev/null
+++ b/llvm/test/CodeGen/X86/20210831-inlineasm.ll
@@ -0,0 +1,20 @@
+; RUN: llc < %s -O0 -mtriple=x86_64-unknown-linux-gnu
+; https://bugs.llvm.org/show_bug.cgi?id=51699
+
+%"[]u8" = type { i8*, i64 }
+%std.mem.Allocator = type { void ({ %"[]u8", i16 }*, %std.builtin.StackTrace*,
%std.mem.Allocator*, i64, i29, i29, i64)*, void ({ i64, i16 }*,
%std.builtin.StackTrace*, %std.mem.Allocator*, %"[]u8"*, i29, i64, i29, i64)* }
+%std.builtin.StackTrace = type { i64, %"[]usize" }
+%"[]usize" = type { i64*, i64 }
+
+define void @fun(%"[]u8"* %0) #0 {
+Entry:
+ %1 = alloca [6 x i64], align 8
+ br label %ErrRetContinue
+
+ErrRetContinue: ; preds = %Entry
+ %2 = call i64 asm sideeffect "rolq $$3, %rdi ; rolq $$13, %rdi\0Arolq $$61,
%rdi ; rolq $$51, %rdi\0Axchgq %rbx,%rbx\0A",
"={rdx},{rax},0,~{cc},~{memory}"(i64 undef, i64 0)
+ %3 = call fastcc i64 undef(%std.mem.Allocator* undef, %"[]u8"* %0, i29
undef, i64 0, i29 0, i64 undef)
+ ret void
+}
+
+attributes #0 = { sspstrong }
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 02dece0 - [clang] fix transformation of template arguments of 'auto' type constraints
Author: Matheus Izvekov
Date: 2021-09-08T14:09:00-07:00
New Revision: 02dece03f93d2ff847c3867e5f655793e29b2877
URL:
https://github.com/llvm/llvm-project/commit/02dece03f93d2ff847c3867e5f655793e29b2877
DIFF:
https://github.com/llvm/llvm-project/commit/02dece03f93d2ff847c3867e5f655793e29b2877.diff
LOG: [clang] fix transformation of template arguments of 'auto' type constraints
See PR48617.
When assigning the new template arguments to the new TypeLoc, we were looping
on the argument count of the original TypeLoc instead of the new one,
which can be different when packs are present.
Signed-off-by: Matheus Izvekov
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D109406
(cherry picked from commit 68b9d8ed7abe4046992ae1557990edfbb3a772bc)
Added:
Modified:
clang/lib/Sema/TreeTransform.h
clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
Removed:
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 70ba631dbfc6..d8a5b6ad4f94 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -6578,7 +6578,7 @@ QualType
TreeTransform::TransformAutoType(TypeLocBuilder &TLB,
NewTL.setFoundDecl(TL.getFoundDecl());
NewTL.setLAngleLoc(TL.getLAngleLoc());
NewTL.setRAngleLoc(TL.getRAngleLoc());
- for (unsigned I = 0; I < TL.getNumArgs(); ++I)
+ for (unsigned I = 0; I < NewTL.getNumArgs(); ++I)
NewTL.setArgLocInfo(I, NewTemplateArgs.arguments()[I].getLocInfo());
return Result;
diff --git a/clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
b/clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
index 7830d1f43526..494102742321 100644
--- a/clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
+++ b/clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
@@ -76,3 +76,25 @@ namespace PR48593 {
template concept d = true;
d<,> auto e = 0; // expected-error{{expected expression}}
}
+
+namespace PR48617 {
+ template concept C = true;
+ template class A {};
+
+ template C auto e(A) { return 0; }
+
+ // FIXME: The error here does not make sense.
+ template auto e<>(A<>);
+ // expected-error@-1 {{explicit instantiation of 'e' does not refer to a
function template}}
+ // expected-note@-5 {{candidate template ignored: failed template argument
deduction}}
+
+ // FIXME: Should be able to instantiate this with no errors.
+ template C auto e(A);
+ // expected-error@-1 {{explicit instantiation of 'e' does not refer to a
function template}}
+ // expected-note@-10 {{candidate template ignored: could not match 'C auto' against 'C auto'}}
+
+ template C<> auto e<>(A<>);
+
+ template A c(Ts...);
+ int f = e(c(1, 2));
+}
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] b77c810 - Revert "[HardwareLoops] Change order of SCEV expression construction for InitLoopCount."
Author: Chen Zheng
Date: 2021-09-08T20:46:17-07:00
New Revision: b77c810feba04d584ad3de70bb6b062c939c52f3
URL:
https://github.com/llvm/llvm-project/commit/b77c810feba04d584ad3de70bb6b062c939c52f3
DIFF:
https://github.com/llvm/llvm-project/commit/b77c810feba04d584ad3de70bb6b062c939c52f3.diff
LOG: Revert "[HardwareLoops] Change order of SCEV expression construction for
InitLoopCount."
This causes https://bugs.llvm.org/show_bug.cgi?id=51714 and
is not a right patch according to comments in D91724
This reverts commit 42eaf4fe0adef3344adfd9fbccd49f325cb549ef.
(cherry picked from commit 34badc409cc452575c538c4b6449546adc38f121)
Added:
Modified:
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/lib/CodeGen/HardwareLoops.cpp
llvm/test/CodeGen/PowerPC/loop-instr-prep-non-const-increasement.ll
llvm/test/CodeGen/PowerPC/mma-phi-accs.ll
Removed:
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h
b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index 628058142e487..5ab58ca0646a2 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -97,7 +97,7 @@ struct HardwareLoopInfo {
Loop *L = nullptr;
BasicBlock *ExitBlock = nullptr;
BranchInst *ExitBranch = nullptr;
- const SCEV *TripCount = nullptr;
+ const SCEV *ExitCount = nullptr;
IntegerType *CountType = nullptr;
Value *LoopDecrement = nullptr; // Decrement the loop counter by this
// value in every iteration.
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp
b/llvm/lib/Analysis/TargetTransformInfo.cpp
index 304d24fe8e4a4..9053acce60c48 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -167,11 +167,7 @@ bool
HardwareLoopInfo::isHardwareLoopCandidate(ScalarEvolution &SE,
// Note that this block may not be the loop latch block, even if the loop
// has a latch block.
ExitBlock = BB;
-TripCount = SE.getAddExpr(EC, SE.getOne(EC->getType()));
-
-if (!EC->getType()->isPointerTy() && EC->getType() != CountType)
- TripCount = SE.getZeroExtendExpr(TripCount, CountType);
-
+ExitCount = EC;
break;
}
diff --git a/llvm/lib/CodeGen/HardwareLoops.cpp
b/llvm/lib/CodeGen/HardwareLoops.cpp
index 4316034371a58..248ef6c23974a 100644
--- a/llvm/lib/CodeGen/HardwareLoops.cpp
+++ b/llvm/lib/CodeGen/HardwareLoops.cpp
@@ -187,7 +187,7 @@ namespace {
const DataLayout &DL,
OptimizationRemarkEmitter *ORE) :
SE(SE), DL(DL), ORE(ORE), L(Info.L), M(L->getHeader()->getModule()),
- TripCount(Info.TripCount),
+ ExitCount(Info.ExitCount),
CountType(Info.CountType),
ExitBranch(Info.ExitBranch),
LoopDecrement(Info.LoopDecrement),
@@ -202,7 +202,7 @@ namespace {
OptimizationRemarkEmitter *ORE = nullptr;
Loop *L = nullptr;
Module *M = nullptr;
-const SCEV *TripCount = nullptr;
+const SCEV *ExitCount = nullptr;
Type *CountType = nullptr;
BranchInst *ExitBranch = nullptr;
Value *LoopDecrement= nullptr;
@@ -296,7 +296,7 @@ bool HardwareLoops::TryConvertLoop(HardwareLoopInfo
&HWLoopInfo) {
}
assert(
- (HWLoopInfo.ExitBlock && HWLoopInfo.ExitBranch && HWLoopInfo.TripCount)
&&
+ (HWLoopInfo.ExitBlock && HWLoopInfo.ExitBranch && HWLoopInfo.ExitCount)
&&
"Hardware Loop must have set exit info.");
BasicBlock *Preheader = L->getLoopPreheader();
@@ -381,13 +381,18 @@ Value *HardwareLoop::InitLoopCount() {
// loop counter and tests that is not zero?
SCEVExpander SCEVE(SE, DL, "loopcnt");
+ if (!ExitCount->getType()->isPointerTy() &&
+ ExitCount->getType() != CountType)
+ExitCount = SE.getZeroExtendExpr(ExitCount, CountType);
+
+ ExitCount = SE.getAddExpr(ExitCount, SE.getOne(CountType));
// If we're trying to use the 'test and set' form of the intrinsic, we need
// to replace a conditional branch that is controlling entry to the loop. It
// is likely (guaranteed?) that the preheader has an unconditional branch to
// the loop header, so also check if it has a single predecessor.
- if (SE.isLoopEntryGuardedByCond(L, ICmpInst::ICMP_NE, TripCount,
- SE.getZero(TripCount->getType( {
+ if (SE.isLoopEntryGuardedByCond(L, ICmpInst::ICMP_NE, ExitCount,
+ SE.getZero(ExitCount->getType( {
LLVM_DEBUG(dbgs() << " - Attempting to use test.set counter.\n");
UseLoopGuard |= ForceGuardLoopEntry;
} else
@@ -399,19 +404,19 @@ Value *HardwareLoop::InitLoopCount() {
BasicBlock *Predecessor = BB->getSinglePredecessor();
// If it's not safe to create a while loop then don't force it and create a
// do-while loop ins
[llvm-branch-commits] [llvm] dc10ff2 - [AArch64][SME] Fix imm bug in mov vector to tile aliases
Author: Cullen Rhodes
Date: 2021-09-08T20:47:08-07:00
New Revision: dc10ff25f54b64cbb36ac56769e01492c0315de8
URL:
https://github.com/llvm/llvm-project/commit/dc10ff25f54b64cbb36ac56769e01492c0315de8
DIFF:
https://github.com/llvm/llvm-project/commit/dc10ff25f54b64cbb36ac56769e01492c0315de8.diff
LOG: [AArch64][SME] Fix imm bug in mov vector to tile aliases
Also fixes a warning mentioned in D109359.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D109363
(cherry picked from commit 89786c2b992c3cb4c4a230542d2af34ec2915a08)
Added:
Modified:
llvm/lib/Target/AArch64/SMEInstrFormats.td
llvm/test/MC/AArch64/SME/mova-diagnostics.s
Removed:
diff --git a/llvm/lib/Target/AArch64/SMEInstrFormats.td
b/llvm/lib/Target/AArch64/SMEInstrFormats.td
index 62089166f4b75..00fd374587bc2 100644
--- a/llvm/lib/Target/AArch64/SMEInstrFormats.td
+++ b/llvm/lib/Target/AArch64/SMEInstrFormats.td
@@ -480,7 +480,7 @@ multiclass sme_vector_to_tile_aliases {
def : InstAlias<"mov\t$ZAd[$Rv, $imm], $Pg/m, $Zn",
- (inst tile_ty:$ZAd, MatrixIndexGPR32Op12_15:$Rv,
imm0_15:$imm, PPR3bAny:$Pg, zpr_ty:$Zn), 1>;
+ (inst tile_ty:$ZAd, MatrixIndexGPR32Op12_15:$Rv,
imm_ty:$imm, PPR3bAny:$Pg, zpr_ty:$Zn), 1>;
}
multiclass sme_vector_v_to_tile {
diff --git a/llvm/test/MC/AArch64/SME/mova-diagnostics.s
b/llvm/test/MC/AArch64/SME/mova-diagnostics.s
index 119a6b170af95..f09ec110f698a 100644
--- a/llvm/test/MC/AArch64/SME/mova-diagnostics.s
+++ b/llvm/test/MC/AArch64/SME/mova-diagnostics.s
@@ -158,6 +158,31 @@ mova z0.q, p0/m, za0h.q[w12, #0]
// CHECK-NEXT: mova z0.q, p0/m, za0h.q[w12, #0]
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+mov z0.b, p0/m, za0h.b[w12, #16]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range
[0, 15].
+// CHECK-NEXT: mov z0.b, p0/m, za0h.b[w12, #16]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+mov z0.h, p0/m, za0h.h[w12, #8]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range
[0, 7].
+// CHECK-NEXT: mov z0.h, p0/m, za0h.h[w12, #8]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+mov z0.s, p0/m, za0h.s[w12, #4]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range
[0, 3].
+// CHECK-NEXT: mov z0.s, p0/m, za0h.s[w12, #4]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+mov z0.d, p0/m, za0h.d[w12, #2]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range
[0, 1].
+// CHECK-NEXT: mov z0.d, p0/m, za0h.d[w12, #2]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+mov z0.q, p0/m, za0h.q[w12, #0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
+// CHECK-NEXT: mov z0.q, p0/m, za0h.q[w12, #0]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
// vector-to-tile
mova za0h.b[w12, #16], p0/m, z0.b
@@ -185,6 +210,31 @@ mova za0h.q[w12, #0], p0/m, z0.q
// CHECK-NEXT: mova za0h.q[w12, #0], p0/m, z0.q
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+mov za0h.b[w12, #16], p0/m, z0.b
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range
[0, 15].
+// CHECK-NEXT: mov za0h.b[w12, #16], p0/m, z0.b
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+mov za0h.h[w12, #8], p0/m, z0.h
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range
[0, 7].
+// CHECK-NEXT: mov za0h.h[w12, #8], p0/m, z0.h
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+mov za0h.s[w12, #4], p0/m, z0.s
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range
[0, 3].
+// CHECK-NEXT: mov za0h.s[w12, #4], p0/m, z0.s
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+mov za0h.d[w12, #2], p0/m, z0.d
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range
[0, 1].
+// CHECK-NEXT: mov za0h.d[w12, #2], p0/m, z0.d
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+mov za0h.q[w12, #0], p0/m, z0.q
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
+// CHECK-NEXT: mov za0h.q[w12, #0], p0/m, z0.q
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
// - //
// Invalid ZPR element width
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] f56129f - Fine grain control over some symbol visibility
Author: serge-sans-paille
Date: 2021-09-08T21:06:19-07:00
New Revision: f56129fe78d5c849971017976c71333b6b1a27c6
URL:
https://github.com/llvm/llvm-project/commit/f56129fe78d5c849971017976c71333b6b1a27c6
DIFF:
https://github.com/llvm/llvm-project/commit/f56129fe78d5c849971017976c71333b6b1a27c6.diff
LOG: Fine grain control over some symbol visibility
Setting -fvisibility=hidden when compiling Target libs has the advantage of
not being intrusive on the codebase, but it also sets the visibility of all
functions within header-only component like ADT. In the end, we end up with
some symbols with hidden visibility within llvm dylib (through the target libs),
and some with external visibility (through other libs). This paves the way for
subtle bugs like https://reviews.llvm.org/D101972
This patch explicitly set the visibility of some classes to `default` so that
`llvm::Any` related symbols keep a `default` visibility. Indeed a template
function with `default` visibility parametrized by a type with `hidden`
visibility is granted `hidden` visibility, and we don't want this for the
uniqueness of `llvm::Any::TypeId`.
Differential Revision: https://reviews.llvm.org/D108943
Added:
Modified:
llvm/include/llvm/Analysis/LazyCallGraph.h
llvm/include/llvm/Analysis/LoopInfo.h
llvm/include/llvm/Analysis/LoopNestAnalysis.h
llvm/include/llvm/CodeGen/MachineFunction.h
llvm/include/llvm/IR/Function.h
llvm/include/llvm/IR/Module.h
Removed:
diff --git a/llvm/include/llvm/Analysis/LazyCallGraph.h
b/llvm/include/llvm/Analysis/LazyCallGraph.h
index ca276d2f3cf8..81500905c0f5 100644
--- a/llvm/include/llvm/Analysis/LazyCallGraph.h
+++ b/llvm/include/llvm/Analysis/LazyCallGraph.h
@@ -419,7 +419,7 @@ class LazyCallGraph {
/// outer structure. SCCs do not support mutation of the call graph, that
/// must be done through the containing \c RefSCC in order to fully reason
/// about the ordering and connections of the graph.
- class SCC {
+ class LLVM_EXTERNAL_VISIBILITY SCC {
friend class LazyCallGraph;
friend class LazyCallGraph::Node;
diff --git a/llvm/include/llvm/Analysis/LoopInfo.h
b/llvm/include/llvm/Analysis/LoopInfo.h
index 164ec50e47bc..5983f98d84cf 100644
--- a/llvm/include/llvm/Analysis/LoopInfo.h
+++ b/llvm/include/llvm/Analysis/LoopInfo.h
@@ -527,7 +527,7 @@ extern template class LoopBase;
/// Represents a single loop in the control flow graph. Note that not all SCCs
/// in the CFG are necessarily loops.
-class Loop : public LoopBase {
+class LLVM_EXTERNAL_VISIBILITY Loop : public LoopBase {
public:
/// A range representing the start and end location of a loop.
class LocRange {
diff --git a/llvm/include/llvm/Analysis/LoopNestAnalysis.h
b/llvm/include/llvm/Analysis/LoopNestAnalysis.h
index 9a749a1c8eae..df10e126c31a 100644
--- a/llvm/include/llvm/Analysis/LoopNestAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopNestAnalysis.h
@@ -24,7 +24,7 @@ using LoopVectorTy = SmallVector;
class LPMUpdater;
/// This class represents a loop nest and can be used to query its properties.
-class LoopNest {
+class LLVM_EXTERNAL_VISIBILITY LoopNest {
public:
/// Construct a loop nest rooted by loop \p Root.
LoopNest(Loop &Root, ScalarEvolution &SE);
diff --git a/llvm/include/llvm/CodeGen/MachineFunction.h
b/llvm/include/llvm/CodeGen/MachineFunction.h
index 786fe908f68f..c63a5d42e9b3 100644
--- a/llvm/include/llvm/CodeGen/MachineFunction.h
+++ b/llvm/include/llvm/CodeGen/MachineFunction.h
@@ -227,7 +227,7 @@ struct LandingPadInfo {
: LandingPadBlock(MBB) {}
};
-class MachineFunction {
+class LLVM_EXTERNAL_VISIBILITY MachineFunction {
Function &F;
const LLVMTargetMachine &Target;
const TargetSubtargetInfo *STI;
diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h
index e0094e2afff2..c33e8e94b467 100644
--- a/llvm/include/llvm/IR/Function.h
+++ b/llvm/include/llvm/IR/Function.h
@@ -58,7 +58,8 @@ class User;
class BranchProbabilityInfo;
class BlockFrequencyInfo;
-class Function : public GlobalObject, public ilist_node {
+class LLVM_EXTERNAL_VISIBILITY Function : public GlobalObject,
+ public ilist_node {
public:
using BasicBlockListType = SymbolTableList;
diff --git a/llvm/include/llvm/IR/Module.h b/llvm/include/llvm/IR/Module.h
index 97aea5aedf22..bd3a196c7181 100644
--- a/llvm/include/llvm/IR/Module.h
+++ b/llvm/include/llvm/IR/Module.h
@@ -64,9 +64,9 @@ class VersionTuple;
/// constant references to global variables in the module. When a global
/// variable is destroyed, it should have no entries in the GlobalValueRefMap.
/// The main container class for the LLVM Intermediate Representation.
-class Module {
-/// @name Types And Enumerations
-/// @{
+class LLVM_EXTERNAL_VISIBILITY Module {
+ /// @name Types And Enumerations
+ /// @{
public:
/// The type for th
