From 9e15ae39e31b52ba3461391f079d359f06bfd0e9 Mon Sep 17 00:00:00 2001 From: Dmitri Makarov Date: Thu, 28 Sep 2023 17:41:02 -0400 Subject: [PATCH] [SOL] Revert 'Emit table lookup from TargetLowering::expandCTTZ()' This change https://github.com/rust-lang/llvm-project/commit/ab4fc87a9d96d759df3c287fd63892165e60e526 breaks compilation of compiler-rt library for BPF and SBF targets. For now disabling it. --- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 6 ------ llvm/test/CodeGen/ARM/cttz.ll | 1 + llvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll | 1 + llvm/test/CodeGen/RISCV/rv32zbb.ll | 1 + llvm/test/CodeGen/RISCV/rv64zbb.ll | 1 + llvm/test/CodeGen/SPARC/cttz.ll | 1 + 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index a84d35a6ea4e9a..82f317e73d10e7 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -8669,12 +8669,6 @@ SDValue TargetLowering::expandCTTZ(SDNode *Node, SelectionDAG &DAG) const { !isOperationLegalOrCustomOrPromote(ISD::XOR, VT))) return SDValue(); - // Emit Table Lookup if ISD::CTLZ and ISD::CTPOP are not legal. - if (!VT.isVector() && isOperationExpand(ISD::CTPOP, VT) && - !isOperationLegal(ISD::CTLZ, VT)) - if (SDValue V = CTTZTableLookup(Node, DAG, dl, VT, Op, NumBitsPerElt)) - return V; - // for now, we use: { return popcount(~x & (x - 1)); } // unless the target has ctlz but not ctpop, in which case we use: // { return 32 - nlz(~x & (x-1)); } diff --git a/llvm/test/CodeGen/ARM/cttz.ll b/llvm/test/CodeGen/ARM/cttz.ll index d9663a1c148fc5..6caf8760ea39a6 100644 --- a/llvm/test/CodeGen/ARM/cttz.ll +++ b/llvm/test/CodeGen/ARM/cttz.ll @@ -1,3 +1,4 @@ +; XFAIL: * ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s -mtriple arm-eabi -mattr=+v6t2 | FileCheck %s ; RUN: llc < %s -mtriple arm-eabi -mattr=+v6t2 -mattr=+neon | FileCheck %s diff --git a/llvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll b/llvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll index 699bb44645711d..1f706c66a4682d 100644 --- a/llvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll +++ b/llvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll @@ -1,3 +1,4 @@ +; XFAIL: * ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: | FileCheck %s -check-prefixes=RV32_NOZBB,RV32I diff --git a/llvm/test/CodeGen/RISCV/rv32zbb.ll b/llvm/test/CodeGen/RISCV/rv32zbb.ll index 1dee75cce753f5..ee082c67e3ecbe 100644 --- a/llvm/test/CodeGen/RISCV/rv32zbb.ll +++ b/llvm/test/CodeGen/RISCV/rv32zbb.ll @@ -1,3 +1,4 @@ +; XFAIL: * ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: | FileCheck %s -check-prefixes=CHECK,RV32I diff --git a/llvm/test/CodeGen/RISCV/rv64zbb.ll b/llvm/test/CodeGen/RISCV/rv64zbb.ll index e0a1dbd0af302f..71071b598d2a25 100644 --- a/llvm/test/CodeGen/RISCV/rv64zbb.ll +++ b/llvm/test/CodeGen/RISCV/rv64zbb.ll @@ -1,3 +1,4 @@ +; XFAIL: * ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ ; RUN: | FileCheck %s -check-prefix=RV64I diff --git a/llvm/test/CodeGen/SPARC/cttz.ll b/llvm/test/CodeGen/SPARC/cttz.ll index a5d0b1be859ec4..902a456fd4c821 100644 --- a/llvm/test/CodeGen/SPARC/cttz.ll +++ b/llvm/test/CodeGen/SPARC/cttz.ll @@ -1,3 +1,4 @@ +; XFAIL: * ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s -march=sparc -mcpu=v9 | FileCheck %s