Skip to content

Commit 18f343a

Browse files
committed
Merge remote-tracking branch 'upstream/release/13.x' into ldc-release/13.x
2 parents 4c0c332 + 75e33f7 commit 18f343a

File tree

6 files changed

+132
-28
lines changed

6 files changed

+132
-28
lines changed

clang/test/Driver/undefined-libs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// STDLIB: error: invalid library name in argument '-stdlib=nostdlib'
66
// STDLIB-EMPTY:
77

8-
// RUN: not %clangxx --target=i386-unknown-linux -rtlib=nortlib %s 2>&1 | FileCheck --check-prefix=RTLIB %s
8+
// RUN: not %clangxx --target=i386-unknown-linux -rtlib=nortlib --unwindlib=libgcc %s 2>&1 | FileCheck --check-prefix=RTLIB %s
99
// RTLIB: error: invalid runtime library name in argument '-rtlib=nortlib'
1010
// RTLIB-EMPTY:
1111

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,11 @@ if( LLVM_ENABLE_PIC )
316316
# Note: GCC<10.3 has a bug on SystemZ.
317317
#
318318
# Note: Clang allows IPO for -fPIC so this optimization is less effective.
319-
# Older Clang may support -fno-semantic-interposition but it used local
320-
# aliases to optimize global variables, which is incompatible with copy
321-
# relocations due to -fno-pic.
319+
# Clang 13 has a bug related to -fsanitize-coverage
320+
# -fno-semantic-interposition (https://reviews.llvm.org/D117183).
322321
if ((CMAKE_COMPILER_IS_GNUCXX AND
323322
NOT (LLVM_NATIVE_ARCH STREQUAL "SystemZ" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.3))
324-
OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 13))
323+
OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 14))
325324
add_flag_if_supported("-fno-semantic-interposition" FNO_SEMANTIC_INTERPOSITION)
326325
endif()
327326
endif()

llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ class ARMDAGToDAGISel : public SelectionDAGISel {
7979

8080
void Select(SDNode *N) override;
8181

82+
/// Return true as some complex patterns, like those that call
83+
/// canExtractShiftFromMul can modify the DAG inplace.
84+
bool ComplexPatternFuncMutatesDAG() const override { return true; }
85+
8286
bool hasNoVMLxHazardUse(SDNode *N) const;
8387
bool isShifterOpProfitable(const SDValue &Shift,
8488
ARM_AM::ShiftOpc ShOpcVal, unsigned ShAmt);

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44079,32 +44079,9 @@ static SDValue combineVectorHADDSUB(SDNode *N, SelectionDAG &DAG,
4407944079
"Unexpected horizontal add/sub opcode");
4408044080

4408144081
if (!shouldUseHorizontalOp(true, DAG, Subtarget)) {
44082-
// For slow-hop targets, if we have a hop with a single op, see if we already
44083-
// have another user that we can reuse and shuffle the result.
4408444082
MVT VT = N->getSimpleValueType(0);
4408544083
SDValue LHS = N->getOperand(0);
4408644084
SDValue RHS = N->getOperand(1);
44087-
if (VT.is128BitVector() && LHS == RHS) {
44088-
for (SDNode *User : LHS->uses()) {
44089-
if (User != N && User->getOpcode() == N->getOpcode()) {
44090-
MVT ShufVT = VT.isFloatingPoint() ? MVT::v4f32 : MVT::v4i32;
44091-
if (User->getOperand(0) == LHS && !User->getOperand(1).isUndef()) {
44092-
return DAG.getBitcast(
44093-
VT,
44094-
DAG.getVectorShuffle(ShufVT, SDLoc(N),
44095-
DAG.getBitcast(ShufVT, SDValue(User, 0)),
44096-
DAG.getUNDEF(ShufVT), {0, 1, 0, 1}));
44097-
}
44098-
if (User->getOperand(1) == LHS && !User->getOperand(0).isUndef()) {
44099-
return DAG.getBitcast(
44100-
VT,
44101-
DAG.getVectorShuffle(ShufVT, SDLoc(N),
44102-
DAG.getBitcast(ShufVT, SDValue(User, 0)),
44103-
DAG.getUNDEF(ShufVT), {2, 3, 2, 3}));
44104-
}
44105-
}
44106-
}
44107-
}
4410844085

4410944086
// HOP(HOP'(X,X),HOP'(Y,Y)) -> HOP(PERMUTE(HOP'(X,Y)),PERMUTE(HOP'(X,Y)).
4411044087
if (LHS != RHS && LHS.getOpcode() == N->getOpcode() &&

llvm/test/CodeGen/ARM/shifter_operand.ll

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,108 @@ define { i32, i32 } @test_multi_use_add(i32 %base, i32 %offset) {
256256

257257
ret { i32, i32 } %ret
258258
}
259+
260+
define i32 @test_new(i32 %x, i32 %y) {
261+
; CHECK-ARM-LABEL: test_new:
262+
; CHECK-ARM: @ %bb.0: @ %entry
263+
; CHECK-ARM-NEXT: movw r2, #48047
264+
; CHECK-ARM-NEXT: mul r1, r1, r2
265+
; CHECK-ARM-NEXT: add r0, r0, r1, lsl #1
266+
; CHECK-ARM-NEXT: bx lr
267+
;
268+
; CHECK-THUMB-LABEL: test_new:
269+
; CHECK-THUMB: @ %bb.0: @ %entry
270+
; CHECK-THUMB-NEXT: movw r2, #48047
271+
; CHECK-THUMB-NEXT: muls r1, r2, r1
272+
; CHECK-THUMB-NEXT: add.w r0, r0, r1, lsl #1
273+
; CHECK-THUMB-NEXT: bx lr
274+
entry:
275+
%mul = mul i32 %y, 96094
276+
%conv = add i32 %mul, %x
277+
ret i32 %conv
278+
}
279+
280+
; This test was hitting issues with deleted nodes because ComplexPatternFuncMutatesDAG
281+
; was not defined.
282+
@arr_9 = external dso_local local_unnamed_addr global [15 x [25 x [18 x i8]]], align 1
283+
define void @test_mutateddag(i32 %b, i32 %c, i32 %d, i1 %cc) {
284+
; CHECK-THUMB-LABEL: test_mutateddag:
285+
; CHECK-THUMB: @ %bb.0: @ %entry
286+
; CHECK-THUMB-NEXT: .save {r4, lr}
287+
; CHECK-THUMB-NEXT: push {r4, lr}
288+
; CHECK-THUMB-NEXT: movw r12, #50608
289+
; CHECK-THUMB-NEXT: movw r4, #51512
290+
; CHECK-THUMB-NEXT: movt r12, #17917
291+
; CHECK-THUMB-NEXT: movt r4, #52
292+
; CHECK-THUMB-NEXT: mla r12, r1, r4, r12
293+
; CHECK-THUMB-NEXT: mov.w r4, #450
294+
; CHECK-THUMB-NEXT: lsls r3, r3, #31
295+
; CHECK-THUMB-NEXT: mul lr, r0, r4
296+
; CHECK-THUMB-NEXT: movw r0, #48047
297+
; CHECK-THUMB-NEXT: muls r0, r1, r0
298+
; CHECK-THUMB-NEXT: movw r1, :lower16:arr_9
299+
; CHECK-THUMB-NEXT: movt r1, :upper16:arr_9
300+
; CHECK-THUMB-NEXT: add.w r0, r2, r0, lsl #1
301+
; CHECK-THUMB-NEXT: movw r2, #24420
302+
; CHECK-THUMB-NEXT: movt r2, #19356
303+
; CHECK-THUMB-NEXT: add.w r0, r0, r0, lsl #3
304+
; CHECK-THUMB-NEXT: add.w r0, r1, r0, lsl #1
305+
; CHECK-THUMB-NEXT: movw r1, #60920
306+
; CHECK-THUMB-NEXT: movt r1, #64028
307+
; CHECK-THUMB-NEXT: add r2, r0
308+
; CHECK-THUMB-NEXT: add r1, r0
309+
; CHECK-THUMB-NEXT: movs r0, #0
310+
; CHECK-THUMB-NEXT: b .LBB19_2
311+
; CHECK-THUMB-NEXT: .LBB19_1: @ %for.cond1.for.cond.cleanup_crit_edge
312+
; CHECK-THUMB-NEXT: @ in Loop: Header=BB19_2 Depth=1
313+
; CHECK-THUMB-NEXT: add r1, lr
314+
; CHECK-THUMB-NEXT: add r2, lr
315+
; CHECK-THUMB-NEXT: .LBB19_2: @ %for.cond
316+
; CHECK-THUMB-NEXT: @ =>This Loop Header: Depth=1
317+
; CHECK-THUMB-NEXT: @ Child Loop BB19_3 Depth 2
318+
; CHECK-THUMB-NEXT: movs r4, #0
319+
; CHECK-THUMB-NEXT: .LBB19_3: @ %for.cond2.preheader
320+
; CHECK-THUMB-NEXT: @ Parent Loop BB19_2 Depth=1
321+
; CHECK-THUMB-NEXT: @ => This Inner Loop Header: Depth=2
322+
; CHECK-THUMB-NEXT: cmp r3, #0
323+
; CHECK-THUMB-NEXT: str r0, [r1, r4]
324+
; CHECK-THUMB-NEXT: bne .LBB19_1
325+
; CHECK-THUMB-NEXT: @ %bb.4: @ %for.cond2.preheader.2
326+
; CHECK-THUMB-NEXT: @ in Loop: Header=BB19_3 Depth=2
327+
; CHECK-THUMB-NEXT: str r0, [r2, r4]
328+
; CHECK-THUMB-NEXT: add r4, r12
329+
; CHECK-THUMB-NEXT: b .LBB19_3
330+
entry:
331+
%0 = add i32 %d, -4
332+
%1 = mul i32 %c, 864846
333+
%2 = add i32 %1, 1367306604
334+
br label %for.cond
335+
336+
for.cond: ; preds = %for.cond1.for.cond.cleanup_crit_edge, %for.cond.preheader
337+
%indvar = phi i32 [ 0, %entry ], [ %indvar.next, %for.cond1.for.cond.cleanup_crit_edge ]
338+
%3 = mul i32 %indvar, %b
339+
%4 = add i32 %3, -2
340+
br label %for.cond2.preheader
341+
342+
for.cond2.preheader: ; preds = %for.cond2.preheader.2, %for.cond
343+
%indvar24 = phi i32 [ 0, %for.cond ], [ %indvar.next25.3, %for.cond2.preheader.2 ]
344+
%indvar.next25 = or i32 %indvar24, 1
345+
%l5 = mul i32 %2, %indvar.next25
346+
%scevgep.1 = getelementptr [15 x [25 x [18 x i8]]], [15 x [25 x [18 x i8]]]* @arr_9, i32 -217196, i32 %4, i32 %0, i32 %l5
347+
%l7 = bitcast i8* %scevgep.1 to i32*
348+
store i32 0, i32* %l7, align 1
349+
br i1 %cc, label %for.cond1.for.cond.cleanup_crit_edge, label %for.cond2.preheader.2
350+
351+
for.cond2.preheader.2: ; preds = %for.cond2.preheader
352+
%indvar.next25.1 = or i32 %indvar24, 2
353+
%l8 = mul i32 %2, %indvar.next25.1
354+
%scevgep.2 = getelementptr [15 x [25 x [18 x i8]]], [15 x [25 x [18 x i8]]]* @arr_9, i32 -217196, i32 %4, i32 %0, i32 %l8
355+
%l10 = bitcast i8* %scevgep.2 to i32*
356+
store i32 0, i32* %l10, align 1
357+
%indvar.next25.3 = add i32 %indvar24, 4
358+
br label %for.cond2.preheader
359+
360+
for.cond1.for.cond.cleanup_crit_edge: ; preds = %for.cond2.preheader
361+
%indvar.next = add i32 %indvar, 1
362+
br label %for.cond
363+
}

llvm/test/CodeGen/X86/horizontal-shuffle-2.ll

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,25 @@ define <4 x float> @test_unpacklo_hadd_v4f32_unary(<4 x float> %0) {
171171
ret <4 x float> %3
172172
}
173173

174+
define <8 x i16> @PR51974(<8 x i16> %a0) {
175+
; SSE-LABEL: PR51974:
176+
; SSE: ## %bb.0:
177+
; SSE-NEXT: movdqa %xmm0, %xmm1
178+
; SSE-NEXT: phaddw %xmm0, %xmm1
179+
; SSE-NEXT: phaddw %xmm0, %xmm1
180+
; SSE-NEXT: movdqa %xmm1, %xmm0
181+
; SSE-NEXT: ret{{[l|q]}}
182+
;
183+
; AVX-LABEL: PR51974:
184+
; AVX: ## %bb.0:
185+
; AVX-NEXT: vphaddw %xmm0, %xmm0, %xmm1
186+
; AVX-NEXT: vphaddw %xmm0, %xmm1, %xmm0
187+
; AVX-NEXT: ret{{[l|q]}}
188+
%r0 = call <8 x i16> @llvm.x86.ssse3.phadd.w.128(<8 x i16> %a0, <8 x i16> %a0)
189+
%r1 = call <8 x i16> @llvm.x86.ssse3.phadd.w.128(<8 x i16> %r0, <8 x i16> %a0)
190+
ret <8 x i16> %r1
191+
}
192+
174193
declare <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float>, <4 x float>)
175194
declare <4 x float> @llvm.x86.sse3.hsub.ps(<4 x float>, <4 x float>)
176195
declare <2 x double> @llvm.x86.sse3.hadd.pd(<2 x double>, <2 x double>)

0 commit comments

Comments
 (0)