Skip to content

Commit 4088678

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:53d080c5b5df into amd-gfx:f0fbc982ed3b
Local branch amd-gfx f0fbc98 Merged main:93743ee56669 into amd-gfx:ab47d36e0ead Remote branch main 53d080c [mlir][Arith] Remove `arith-to-llvm` from `func-to-llvm` (llvm#120548)
2 parents f0fbc98 + 53d080c commit 4088678

File tree

22 files changed

+206
-32
lines changed

22 files changed

+206
-32
lines changed

bolt/lib/Core/BinaryContext.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,15 @@ void BinaryContext::printInstruction(raw_ostream &OS, const MCInst &Instruction,
19611961
OS << "\tjit\t" << MIB->getTargetSymbol(Instruction)->getName()
19621962
<< " # ID: " << DynamicID;
19631963
} else {
1964-
InstPrinter->printInst(&Instruction, 0, "", *STI, OS);
1964+
// If there are annotations on the instruction, the MCInstPrinter will fail
1965+
// to print the preferred alias as it only does so when the number of
1966+
// operands is as expected. See
1967+
// https://github.com/llvm/llvm-project/blob/782f1a0d895646c364a53f9dcdd6d4ec1f3e5ea0/llvm/lib/MC/MCInstPrinter.cpp#L142
1968+
// Therefore, create a temporary copy of the Inst from which the annotations
1969+
// are removed, and print that Inst.
1970+
MCInst InstNoAnnot = Instruction;
1971+
MIB->stripAnnotations(InstNoAnnot);
1972+
InstPrinter->printInst(&InstNoAnnot, 0, "", *STI, OS);
19651973
}
19661974
if (MIB->isCall(Instruction)) {
19671975
if (MIB->isTailCall(Instruction))

bolt/test/RISCV/call-annotations.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ f:
1616

1717
// CHECK-LABEL: Binary Function "_start" after building cfg {
1818
// CHECK: auipc ra, f
19-
// CHECK-NEXT: jalr ra, -0x4(ra) # Offset: 4
20-
// CHECK-NEXT: jal ra, f # Offset: 8
21-
// CHECK-NEXT: jal zero, f # TAILCALL # Offset: 12
19+
// CHECK-NEXT: jalr -0x4(ra) # Offset: 4
20+
// CHECK-NEXT: jal f # Offset: 8
21+
// CHECK-NEXT: j f # TAILCALL # Offset: 12
2222

2323
// CHECK-LABEL: Binary Function "long_tail" after building cfg {
2424
// CHECK: auipc t1, f
25-
// CHECK-NEXT: jalr zero, -0x18(t1) # TAILCALL # Offset: 8
25+
// CHECK-NEXT: jr -0x18(t1) # TAILCALL # Offset: 8
2626

2727
// CHECK-LABEL: Binary Function "compressed_tail" after building cfg {
2828
// CHECK: jr a0 # TAILCALL # Offset: 0

bolt/test/RISCV/relax.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
// RUN: llvm-objdump -d %t.bolt | FileCheck --check-prefix=OBJDUMP %s
66

77
// CHECK: Binary Function "_start" after building cfg {
8-
// CHECK: jal ra, near_f
8+
// CHECK: jal near_f
99
// CHECK-NEXT: auipc ra, far_f
10-
// CHECK-NEXT: jalr ra, 0xc(ra)
10+
// CHECK-NEXT: jalr 0xc(ra)
1111
// CHECK-NEXT: j near_f
1212

1313
// CHECK: Binary Function "_start" after fix-riscv-calls {

bolt/test/RISCV/reloc-branch.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
.p2align 1
88
// CHECK: Binary Function "_start" after building cfg {
99
_start:
10-
// CHECK: beq zero, zero, .Ltmp0
10+
// CHECK: beqz zero, .Ltmp0
1111
beq zero, zero, 1f
1212
nop
1313
// CHECK: .Ltmp0

bolt/test/RISCV/reloc-jal.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ f:
1414
.globl _start
1515
.p2align 1
1616
_start:
17-
// CHECK: jal ra, f
17+
// CHECK: jal f
1818
jal ra, f
1919
ret
2020
.size _start, .-_start

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,8 @@ Improvements to Clang's diagnostics
706706
return ptr + index < ptr; // warning
707707
}
708708
709+
- Fix -Wdangling false positives on conditional operators (#120206).
710+
709711
Improvements to Clang's time-trace
710712
----------------------------------
711713

clang/lib/Sema/CheckExprLifetime.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,15 @@ static void visitFunctionCallArguments(IndirectLocalPath &Path, Expr *Call,
582582
// Temp().ptr; // Here ptr might not dangle.
583583
if (isa<MemberExpr>(Arg->IgnoreImpCasts()))
584584
return;
585+
// Avoid false positives when the object is constructed from a conditional
586+
// operator argument. A common case is:
587+
// // 'ptr' might not be owned by the Owner object.
588+
// std::string_view s = cond() ? Owner().ptr : sv;
589+
if (const auto *Cond =
590+
dyn_cast<AbstractConditionalOperator>(Arg->IgnoreImpCasts());
591+
Cond && isPointerLikeType(Cond->getType()))
592+
return;
593+
585594
auto ReturnType = Callee->getReturnType();
586595

587596
// Once we initialized a value with a non gsl-owner reference, it can no

clang/test/Sema/warn-lifetime-analysis-nocfg.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,3 +777,32 @@ void test4() {
777777
}
778778

779779
} // namespace LifetimeboundInterleave
780+
781+
namespace GH120206 {
782+
struct S {
783+
std::string_view s;
784+
};
785+
786+
struct [[gsl::Owner]] Q1 {
787+
const S* get() const [[clang::lifetimebound]];
788+
};
789+
std::string_view test1(int c, std::string_view sv) {
790+
std::string_view k = c > 1 ? Q1().get()->s : sv;
791+
if (c == 1)
792+
return c > 1 ? Q1().get()->s : sv;
793+
Q1 q;
794+
return c > 1 ? q.get()->s : sv;
795+
}
796+
797+
struct Q2 {
798+
const S* get() const [[clang::lifetimebound]];
799+
};
800+
std::string_view test2(int c, std::string_view sv) {
801+
std::string_view k = c > 1 ? Q2().get()->s : sv;
802+
if (c == 1)
803+
return c > 1 ? Q2().get()->s : sv;
804+
Q2 q;
805+
return c > 1 ? q.get()->s : sv;
806+
}
807+
808+
} // namespace GH120206

llvm/Maintainers.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ [email protected] (email), [asb](https://github.com/asb) (GitHub)
251251

252252
#### Sparc backend
253253

254-
Venkatraman Govindaraju \
255-
[email protected] (email), [vegovin](https://github.com/vegovin) (GitHub)
254+
Koakuma \
255+
[email protected] (email), [koachan](https://github.com/koachan) (GitHub)
256256

257257
#### SPIRV backend
258258

@@ -320,16 +320,11 @@ [email protected] (email), [echristo](https://github.com/echristo) (GitHub)
320320
Benjamin Kramer \
321321
[email protected] (email), [d0k](https://github.com/d0k) (GitHub)
322322

323-
#### IR Linker
323+
#### IR Linker and LTO
324324

325325
Teresa Johnson \
326326
[email protected] (email), [teresajohnson](https://github.com/teresajohnson) (GitHub)
327327

328-
#### LTO
329-
330-
Peter Collingbourne \
331-
[email protected] (email), [pcc](https://github.com/pcc) (GitHub)
332-
333328
#### MCJIT, Orc, RuntimeDyld, PerfJITEvents
334329

335330
Lang Hames \
@@ -456,9 +451,11 @@ [email protected] (email), [lattner](https://github.com/lattner) (GitHub), clattn
456451
Paul C. Anagnostopoulos ([email protected], [Paul-C-Anagnostopoulos](https://github.com/Paul-C-Anagnostopoulos)) -- TableGen \
457452
Justin Bogner ([email protected], [bogner](https://github.com/bogner)) -- SelectionDAG \
458453
Chandler Carruth ([email protected], [email protected], [chandlerc](https://github.com/chandlerc)) -- ADT, Support \
454+
Peter Collingbourne ([email protected], [pcc](https://github.com/pcc)) -- LTO \
459455
Evan Cheng ([email protected]) -- Parts of code generator not covered by someone else \
460456
Jake Ehrlich ([email protected], [jakehehrlich](https://github.com/jakehehrlich)) -- llvm-objcopy and ObjCopy library \
461457
Renato Golin ([email protected], [rengolin](https://github.com/rengolin)) -- ARM backend \
458+
Venkatraman Govindaraju ([email protected], [vegovin](https://github.com/vegovin) -- Sparc backend \
462459
James Grosbach ([email protected]) -- MC layer \
463460
Anton Korobeynikov ([email protected], [asl](https://github.com/asl)) -- ARM EABI \
464461
Chad Rosier ([email protected]) -- FastISel \

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 521731
19+
#define LLVM_MAIN_REVISION 522087
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,12 +1113,15 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
11131113
for (MVT VT : MVT::fp_valuetypes()) {
11141114
setLoadExtAction(ISD::EXTLOAD, VT, MVT::f32, Expand);
11151115
setLoadExtAction(ISD::EXTLOAD, VT, MVT::f16, Expand);
1116+
setLoadExtAction(ISD::EXTLOAD, VT, MVT::bf16, Expand);
11161117
}
11171118

11181119
// ... or truncating stores
11191120
setTruncStoreAction(MVT::f64, MVT::f32, Expand);
11201121
setTruncStoreAction(MVT::f32, MVT::f16, Expand);
11211122
setTruncStoreAction(MVT::f64, MVT::f16, Expand);
1123+
setTruncStoreAction(MVT::f32, MVT::bf16, Expand);
1124+
setTruncStoreAction(MVT::f64, MVT::bf16, Expand);
11221125

11231126
// ARM does not have i1 sign extending load.
11241127
for (MVT VT : MVT::integer_valuetypes())

llvm/test/CodeGen/Thumb2/bf16-instructions.ll

Lines changed: 99 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,55 @@ define void @test_store(bfloat %a, ptr %b) {
220220
ret void
221221
}
222222

223+
define void @test_truncstore32(float %a, ptr %b) {
224+
; CHECK-NOFP-LABEL: test_truncstore32:
225+
; CHECK-NOFP: @ %bb.0:
226+
; CHECK-NOFP-NEXT: .save {r4, lr}
227+
; CHECK-NOFP-NEXT: push {r4, lr}
228+
; CHECK-NOFP-NEXT: mov r4, r1
229+
; CHECK-NOFP-NEXT: bl __truncsfbf2
230+
; CHECK-NOFP-NEXT: strh r0, [r4]
231+
; CHECK-NOFP-NEXT: pop {r4, pc}
232+
;
233+
; CHECK-FP-LABEL: test_truncstore32:
234+
; CHECK-FP: @ %bb.0:
235+
; CHECK-FP-NEXT: .save {r4, lr}
236+
; CHECK-FP-NEXT: push {r4, lr}
237+
; CHECK-FP-NEXT: mov r4, r0
238+
; CHECK-FP-NEXT: bl __truncsfbf2
239+
; CHECK-FP-NEXT: vmov r0, s0
240+
; CHECK-FP-NEXT: strh r0, [r4]
241+
; CHECK-FP-NEXT: pop {r4, pc}
242+
%r = fptrunc float %a to bfloat
243+
store bfloat %r, ptr %b
244+
ret void
245+
}
246+
247+
define void @test_truncstore64(double %a, ptr %b) {
248+
; CHECK-NOFP-LABEL: test_truncstore64:
249+
; CHECK-NOFP: @ %bb.0:
250+
; CHECK-NOFP-NEXT: .save {r4, lr}
251+
; CHECK-NOFP-NEXT: push {r4, lr}
252+
; CHECK-NOFP-NEXT: mov r4, r2
253+
; CHECK-NOFP-NEXT: bl __truncdfbf2
254+
; CHECK-NOFP-NEXT: strh r0, [r4]
255+
; CHECK-NOFP-NEXT: pop {r4, pc}
256+
;
257+
; CHECK-FP-LABEL: test_truncstore64:
258+
; CHECK-FP: @ %bb.0:
259+
; CHECK-FP-NEXT: .save {r4, lr}
260+
; CHECK-FP-NEXT: push {r4, lr}
261+
; CHECK-FP-NEXT: mov r4, r0
262+
; CHECK-FP-NEXT: vmov r0, r1, d0
263+
; CHECK-FP-NEXT: bl __aeabi_d2f
264+
; CHECK-FP-NEXT: lsrs r0, r0, #16
265+
; CHECK-FP-NEXT: strh r0, [r4]
266+
; CHECK-FP-NEXT: pop {r4, pc}
267+
%r = fptrunc double %a to bfloat
268+
store bfloat %r, ptr %b
269+
ret void
270+
}
271+
223272
define bfloat @test_load(ptr %a) {
224273
; CHECK-NOFP-LABEL: test_load:
225274
; CHECK-NOFP: @ %bb.0:
@@ -235,6 +284,48 @@ define bfloat @test_load(ptr %a) {
235284
ret bfloat %r
236285
}
237286

287+
define float @test_loadext32(ptr %a) {
288+
; CHECK-NOFP-LABEL: test_loadext32:
289+
; CHECK-NOFP: @ %bb.0:
290+
; CHECK-NOFP-NEXT: ldrh r0, [r0]
291+
; CHECK-NOFP-NEXT: lsls r0, r0, #16
292+
; CHECK-NOFP-NEXT: bx lr
293+
;
294+
; CHECK-FP-LABEL: test_loadext32:
295+
; CHECK-FP: @ %bb.0:
296+
; CHECK-FP-NEXT: ldrh r0, [r0]
297+
; CHECK-FP-NEXT: lsls r0, r0, #16
298+
; CHECK-FP-NEXT: vmov s0, r0
299+
; CHECK-FP-NEXT: bx lr
300+
%r = load bfloat, ptr %a
301+
%d = fpext bfloat %r to float
302+
ret float %d
303+
}
304+
305+
define double @test_loadext64(ptr %a) {
306+
; CHECK-NOFP-LABEL: test_loadext64:
307+
; CHECK-NOFP: @ %bb.0:
308+
; CHECK-NOFP-NEXT: .save {r7, lr}
309+
; CHECK-NOFP-NEXT: push {r7, lr}
310+
; CHECK-NOFP-NEXT: ldrh r0, [r0]
311+
; CHECK-NOFP-NEXT: lsls r0, r0, #16
312+
; CHECK-NOFP-NEXT: bl __aeabi_f2d
313+
; CHECK-NOFP-NEXT: pop {r7, pc}
314+
;
315+
; CHECK-FP-LABEL: test_loadext64:
316+
; CHECK-FP: @ %bb.0:
317+
; CHECK-FP-NEXT: .save {r7, lr}
318+
; CHECK-FP-NEXT: push {r7, lr}
319+
; CHECK-FP-NEXT: ldrh r0, [r0]
320+
; CHECK-FP-NEXT: lsls r0, r0, #16
321+
; CHECK-FP-NEXT: bl __aeabi_f2d
322+
; CHECK-FP-NEXT: vmov d0, r0, r1
323+
; CHECK-FP-NEXT: pop {r7, pc}
324+
%r = load bfloat, ptr %a
325+
%d = fpext bfloat %r to double
326+
ret double %d
327+
}
328+
238329
declare bfloat @test_callee(bfloat %a, bfloat %b)
239330

240331
define bfloat @test_call(bfloat %a, bfloat %b) {
@@ -867,8 +958,8 @@ define void @test_fccmp(bfloat %in, ptr %out) {
867958
; CHECK-FP-LABEL: test_fccmp:
868959
; CHECK-FP: @ %bb.0:
869960
; CHECK-FP-NEXT: vmov r1, s0
870-
; CHECK-FP-NEXT: vldr s0, .LCPI30_0
871-
; CHECK-FP-NEXT: vldr s4, .LCPI30_1
961+
; CHECK-FP-NEXT: vldr s0, .LCPI34_0
962+
; CHECK-FP-NEXT: vldr s4, .LCPI34_1
872963
; CHECK-FP-NEXT: lsls r2, r1, #16
873964
; CHECK-FP-NEXT: vmov s2, r2
874965
; CHECK-FP-NEXT: mov.w r2, #17664
@@ -882,9 +973,9 @@ define void @test_fccmp(bfloat %in, ptr %out) {
882973
; CHECK-FP-NEXT: bx lr
883974
; CHECK-FP-NEXT: .p2align 2
884975
; CHECK-FP-NEXT: @ %bb.1:
885-
; CHECK-FP-NEXT: .LCPI30_0:
976+
; CHECK-FP-NEXT: .LCPI34_0:
886977
; CHECK-FP-NEXT: .long 0x45000000 @ float 2048
887-
; CHECK-FP-NEXT: .LCPI30_1:
978+
; CHECK-FP-NEXT: .LCPI34_1:
888979
; CHECK-FP-NEXT: .long 0x48000000 @ float 131072
889980
%cmp1 = fcmp ogt bfloat %in, 0xR4800
890981
%cmp2 = fcmp olt bfloat %in, 0xR4500
@@ -941,14 +1032,14 @@ define bfloat @test_phi(ptr %p1) {
9411032
; CHECK-NOFP-NEXT: push {r4, r5, r6, lr}
9421033
; CHECK-NOFP-NEXT: ldrh r6, [r0]
9431034
; CHECK-NOFP-NEXT: mov r4, r0
944-
; CHECK-NOFP-NEXT: .LBB32_1: @ %loop
1035+
; CHECK-NOFP-NEXT: .LBB36_1: @ %loop
9451036
; CHECK-NOFP-NEXT: @ =>This Inner Loop Header: Depth=1
9461037
; CHECK-NOFP-NEXT: mov r0, r4
9471038
; CHECK-NOFP-NEXT: mov r5, r6
9481039
; CHECK-NOFP-NEXT: ldrh r6, [r4]
9491040
; CHECK-NOFP-NEXT: bl test_dummy
9501041
; CHECK-NOFP-NEXT: lsls r0, r0, #31
951-
; CHECK-NOFP-NEXT: bne .LBB32_1
1042+
; CHECK-NOFP-NEXT: bne .LBB36_1
9521043
; CHECK-NOFP-NEXT: @ %bb.2: @ %return
9531044
; CHECK-NOFP-NEXT: mov r0, r5
9541045
; CHECK-NOFP-NEXT: pop {r4, r5, r6, pc}
@@ -962,15 +1053,15 @@ define bfloat @test_phi(ptr %p1) {
9621053
; CHECK-FP-NEXT: mov r4, r0
9631054
; CHECK-FP-NEXT: ldrh r0, [r0]
9641055
; CHECK-FP-NEXT: vmov s18, r0
965-
; CHECK-FP-NEXT: .LBB32_1: @ %loop
1056+
; CHECK-FP-NEXT: .LBB36_1: @ %loop
9661057
; CHECK-FP-NEXT: @ =>This Inner Loop Header: Depth=1
9671058
; CHECK-FP-NEXT: ldrh r0, [r4]
9681059
; CHECK-FP-NEXT: vmov.f32 s16, s18
9691060
; CHECK-FP-NEXT: vmov s18, r0
9701061
; CHECK-FP-NEXT: mov r0, r4
9711062
; CHECK-FP-NEXT: bl test_dummy
9721063
; CHECK-FP-NEXT: lsls r0, r0, #31
973-
; CHECK-FP-NEXT: bne .LBB32_1
1064+
; CHECK-FP-NEXT: bne .LBB36_1
9741065
; CHECK-FP-NEXT: @ %bb.2: @ %return
9751066
; CHECK-FP-NEXT: vmov.f32 s0, s16
9761067
; CHECK-FP-NEXT: vpop {d8, d9}

mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,6 @@ struct ConvertFuncToLLVMPass
787787

788788
// TODO(https://github.com/llvm/llvm-project/issues/70982): Remove these in
789789
// favor of their dedicated conversion passes.
790-
arith::populateArithToLLVMConversionPatterns(typeConverter, patterns);
791790
cf::populateControlFlowToLLVMConversionPatterns(typeConverter, patterns);
792791

793792
LLVMConversionTarget target(getContext());

mlir/lib/Dialect/SCF/Utils/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ FailureOr<func::FuncOp> mlir::outlineSingleBlockRegion(RewriterBase &rewriter,
130130

131131
// Outline before current function.
132132
OpBuilder::InsertionGuard g(rewriter);
133-
rewriter.setInsertionPoint(region.getParentOfType<func::FuncOp>());
133+
rewriter.setInsertionPoint(region.getParentOfType<FunctionOpInterface>());
134134

135135
SetVector<Value> captures;
136136
getUsedValuesDefinedAbove(region, captures);

mlir/test/Dialect/ArmSVE/legalize-for-llvm.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: mlir-opt -convert-vector-to-llvm="enable-arm-sve" -convert-func-to-llvm -cse -reconcile-unrealized-casts -split-input-file %s | FileCheck %s
1+
// RUN: mlir-opt -convert-vector-to-llvm="enable-arm-sve" -convert-func-to-llvm -convert-arith-to-llvm -cse -reconcile-unrealized-casts -split-input-file %s | FileCheck %s
22

33
func.func @arm_sve_sdot(%a: vector<[16]xi8>,
44
%b: vector<[16]xi8>,

0 commit comments

Comments
 (0)