Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .ci/premerge_advisor_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@

import generate_test_report_lib

PREMERGE_ADVISOR_URL = (
"http://premerge-advisor.premerge-advisor.svc.cluster.local:5000/upload"
)
# These are IP addresses of the two premerge advisor instances. They should
# eventually be updated to domain names.
PREMERGE_ADVISOR_URLS = [
"http://34.82.126.63:5000/upload",
"http://136.114.125.23:5000/upload",
]


def main(commit_sha, workflow_run_number, build_log_files):
Expand All @@ -41,7 +44,8 @@ def main(commit_sha, workflow_run_number, build_log_files):
ninja_failures = generate_test_report_lib.find_failure_in_ninja_logs(ninja_logs)
for name, failure_message in ninja_failures:
failure_info["failures"].append({"name": name, "message": failure_message})
requests.post(PREMERGE_ADVISOR_URL, json=failure_info)
for premerge_advisor_url in PREMERGE_ADVISOR_URLS:
requests.post(premerge_advisor_url, json=failure_info)


if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/ADT/RadixTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <limits>
#include <list>
#include <utility>
#include <vector>

namespace llvm {

Expand Down
12 changes: 7 additions & 5 deletions llvm/lib/Target/ARM/ARMInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -6546,23 +6546,25 @@ def KCFI_CHECK_ARM
: PseudoInst<(outs), (ins GPR:$ptr, i32imm:$type), NoItinerary, []>,
Sched<[]>,
Requires<[IsARM]> {
let Size = 28; // 7 instructions (bic, ldr, 4x eor, beq, udf)
let Size = 40; // worst-case 10 instructions @ 4 bytes each
// (push, bic, ldr, 4x eor, pop, beq, udf)
}

def KCFI_CHECK_Thumb2
: PseudoInst<(outs), (ins GPR:$ptr, i32imm:$type), NoItinerary, []>,
Sched<[]>,
Requires<[IsThumb2]> {
let Size =
32; // worst-case 9 instructions (push, bic, ldr, 4x eor, pop, beq.w, udf)
let Size = 34; // worst-case (push.w[2], bic[4], ldr[4], 4x eor[16], pop.w[2],
// beq.w[4], udf[2])
}

def KCFI_CHECK_Thumb1
: PseudoInst<(outs), (ins GPR:$ptr, i32imm:$type), NoItinerary, []>,
Sched<[]>,
Requires<[IsThumb1Only]> {
let Size = 50; // worst-case 25 instructions (pushes, bic helper, type
// building, cmp, pops)
let Size = 38; // worst-case 19 instructions @ 2 bytes each
// (2x push, 3x bic-helper, subs+ldr, 13x type-building, cmp,
// 2x pop, beq, bkpt)
}

//===----------------------------------------------------------------------===//
Expand Down
56 changes: 45 additions & 11 deletions llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4721,9 +4721,6 @@ bool X86DAGToDAGISel::tryVPTERNLOG(SDNode *N) {
if (!(Subtarget->hasVLX() || NVT.is512BitVector()))
return false;

SDValue N0 = N->getOperand(0);
SDValue N1 = N->getOperand(1);

auto getFoldableLogicOp = [](SDValue Op) {
// Peek through single use bitcast.
if (Op.getOpcode() == ISD::BITCAST && Op.hasOneUse())
Expand All @@ -4740,13 +4737,47 @@ bool X86DAGToDAGISel::tryVPTERNLOG(SDNode *N) {
return SDValue();
};

SDValue A, FoldableOp;
if ((FoldableOp = getFoldableLogicOp(N1))) {
A = N0;
} else if ((FoldableOp = getFoldableLogicOp(N0))) {
A = N1;
} else
return false;
SDValue N0, N1, A, FoldableOp;

// Identify and (optionally) peel an outer NOT that wraps a pure logic tree
auto tryPeelOuterNotWrappingLogic = [&](SDNode *Op) {
if (Op->getOpcode() == ISD::XOR && Op->hasOneUse() &&
ISD::isBuildVectorAllOnes(Op->getOperand(1).getNode())) {
SDValue InnerOp = Op->getOperand(0);

if (!getFoldableLogicOp(InnerOp))
return SDValue();

N0 = InnerOp.getOperand(0);
N1 = InnerOp.getOperand(1);
if ((FoldableOp = getFoldableLogicOp(N1))) {
A = N0;
return InnerOp;
}
if ((FoldableOp = getFoldableLogicOp(N0))) {
A = N1;
return InnerOp;
}
}
return SDValue();
};

bool PeeledOuterNot = false;
SDNode *OriN = N;
if (SDValue InnerOp = tryPeelOuterNotWrappingLogic(N)) {
PeeledOuterNot = true;
N = InnerOp.getNode();
} else {
N0 = N->getOperand(0);
N1 = N->getOperand(1);

if ((FoldableOp = getFoldableLogicOp(N1)))
A = N0;
else if ((FoldableOp = getFoldableLogicOp(N0)))
A = N1;
else
return false;
}

SDValue B = FoldableOp.getOperand(0);
SDValue C = FoldableOp.getOperand(1);
Expand Down Expand Up @@ -4798,7 +4829,10 @@ bool X86DAGToDAGISel::tryVPTERNLOG(SDNode *N) {
case ISD::XOR: Imm ^= TernlogMagicA; break;
}

return matchVPTERNLOG(N, ParentA, ParentB, ParentC, A, B, C, Imm);
if (PeeledOuterNot)
Imm = ~Imm;

return matchVPTERNLOG(OriN, ParentA, ParentB, ParentC, A, B, C, Imm);
}

/// If the high bits of an 'and' operand are known zero, try setting the
Expand Down
13 changes: 13 additions & 0 deletions llvm/test/CodeGen/X86/issue163738.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx512f,+avx512vl | FileCheck %s --check-prefixes=CHECK

define <8 x i64> @foo(<8 x i64> %a, <8 x i64> %b, <8 x i64> %c) {
; CHECK-LABEL: foo:
; CHECK: # %bb.0:
; CHECK-NEXT: vpternlogq {{.*#+}} zmm0 = ~(zmm0 | zmm2 | zmm1)
; CHECK-NEXT: retq
%and.demorgan = or <8 x i64> %b, %a
%and3.demorgan = or <8 x i64> %and.demorgan, %c
%and3 = xor <8 x i64> %and3.demorgan, splat (i64 -1)
ret <8 x i64> %and3
}