plctlab / llvm-project

PLCT实验室的 RISC-V V Spec 实现,基于llvm/llvm-project,rkruppe/rvv-llvm 和 https://repo.hca.bsc.es/gitlab/rferrer/llvm-epi-0.8
159 stars 40 forks source link

RISC-V zce decbnez #28

Closed farhanpapin closed 3 years ago

farhanpapin commented 3 years ago

added support for the decrement branch not equal zero instruction

farhanpapin commented 3 years ago

@lazyparser I am trying to add support for a new instruction in the RISCV ZCE extension, I am not able to see the details of the one failing test. could you kindly guide on how I can resolve this?

lazyparser commented 3 years ago

@lazyparser I am trying to add support for a new instruction in the RISCV ZCE extension, I am not able to see the details of the one failing test. could you kindly guide on how I can resolve this?

Hi @farhanpapin

Thanks for contributing! The log is here: https://llvm.ngrok.io/logs/28-run-2021-10-20T16:23:24.617Z.log

The build steps can be found here: https://github.com/plctlab/github-ci-for-llvm/blob/master/Dockerfile

and @ChunyuLiao may provide more details on the error messages.

farhanpapin commented 3 years ago

@ChunyuLiao My pass does not touch Load/Store instructions. Any insights on this ?

image

ChunyuLiao commented 3 years ago

@farhanpapin You can try this patch to fix ci.

At the same time, you should add test case for this patch

diff --git a/llvm/lib/Target/RISCV/RISCVDecBNEZ.cpp b/llvm/lib/Target/RISCV/RISCVDecBNEZ.cpp
index 50095071a0a2..a43a422f5143 100644
--- a/llvm/lib/Target/RISCV/RISCVDecBNEZ.cpp
+++ b/llvm/lib/Target/RISCV/RISCVDecBNEZ.cpp
@@ -33,9 +33,11 @@
 #include "RISCVSubtarget.h"
 #include "llvm/CodeGen/MachineBasicBlock.h"
 #include "llvm/CodeGen/MachineInstrBuilder.h"
+#include "llvm/Support/Debug.h"

 using namespace llvm;

+#define DEBUG_TYPE "riscv-decbnez"
 #define RISCV_DECBNEZ_NAME "RISCVDecbnez"
 namespace {

@@ -71,7 +73,7 @@ bool RISCVDecbnez::runOnMachineFunction(MachineFunction &MF) {
   bool Modified = false;

   if (!STI->hasStdExtZce()){
-    dbgs() << "no hasStdExtZce. returning \n";
+    LLVM_DEBUG(dbgs() << "no hasStdExtZce. returning \n");
     return Modified;
   }
farhanpapin commented 3 years ago

@ChunyuLiao I am a bit flustered on this. What is the permission denied error?

image

14 953.3 : 'RUN: at line 11'; not /llvm-project/build/bin/llvm-ar p /llvm-project/build/test/tools/llvm-ar/Output/error-opening-permission.test.tmp/permission.b 2>&1 | /llvm-project/build/bin/FileCheck /llvm-project/llvm/test/tools/llvm-ar/error-opening-permission.test --check-prefix=NO-PERMISSION -DARCHIVE=/llvm-project/build/test/tools/llvm-ar/Output/error-opening-permission.test.tmp/permission.b -DMSG='Permission denied'

14 953.3 --

14 953.3 Exit Code: 1

14 953.3

14 953.3 Command Output (stderr):

14 953.3 --

14 953.3 /llvm-project/llvm/test/tools/llvm-ar/error-opening-permission.test:14:18: error: NO-PERMISSION: expected string not found in input

14 953.3 # NO-PERMISSION: error: unable to open '[[ARCHIVE]]': [[MSG]]

14 953.3 ^

14 953.3 :1:1: note: scanning from here

14 953.3 file1

14 953.3 ^

14 953.3 :1:1: note: with "ARCHIVE" equal to "/llvm-project/build/test/tools/llvm-ar/Output/error-opening-permission\.test\.tmp/permission\.b"

14 953.3 file1

14 953.3 ^

14 953.3 :1:1: note: with "MSG" equal to "Permission denied"

14 953.3 file1

14 953.3 ^

14 953.3

14 953.3 Input file:

14 953.3 Check file: /llvm-project/llvm/test/tools/llvm-ar/error-opening-permission.test

14 953.3

14 953.3 -dump-input=help explains the following input dump.

14 953.3

14 953.3 Input was:

14 953.3 <<<<<<

14 953.3 1: file1

14 953.3 check:14'0 X~ error: no match found

14 953.3 check:14'1 with "ARCHIVE" equal to "/llvm-project/build/test/tools/llvm-ar/Output/error-opening-permission\.test\.tmp/permission\.b"

14 953.3 check:14'2 with "MSG" equal to "Permission denied"

14 953.3 >>>>>>

14 953.3

14 953.3 --

14 953.3

14 953.3 ****

14 953.3 Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80..

14 954.0 FAIL: LLVM :: tools/llvm-elfabi/fail-file-write.test (63095 of 71197)

14 954.0 **** TEST 'LLVM :: tools/llvm-elfabi/fail-file-write.test' FAILED ****

14 954.0 Script:

14 954.0 --

14 954.0 : 'RUN: at line 4'; rm -rf /llvm-project/build/test/tools/llvm-elfabi/Output/fail-file-write.test.tmp.TestDir

14 954.0 : 'RUN: at line 5'; mkdir /llvm-project/build/test/tools/llvm-elfabi/Output/fail-file-write.test.tmp.TestDir

14 954.0 : 'RUN: at line 6'; touch /llvm-project/build/test/tools/llvm-elfabi/Output/fail-file-write.test.tmp.TestDir/Output.TestFile

14 954.0 : 'RUN: at line 7'; chmod 400 /llvm-project/build/test/tools/llvm-elfabi/Output/fail-file-write.test.tmp.TestDir

14 954.0 : 'RUN: at line 8'; not llvm-elfabi /llvm-project/llvm/test/tools/llvm-elfabi/fail-file-write.test --output-target=elf64-little /llvm-project/build/test/tools/llvm-elfabi/Output/fail-file-write.test.tmp.TestDir/Output.TestFile 2>&1 | /llvm-project/build/bin/FileCheck -DMSG='Permission denied' /llvm-project/llvm/test/tools/llvm-elfabi/fail-file-write.test --check-prefix=ERR

14 954.0 : 'RUN: at line 9'; chmod 777 /llvm-project/build/test/tools/llvm-elfabi/Output/fail-file-write.test.tmp.TestDir

14 954.0 : 'RUN: at line 10'; rm -rf /llvm-project/build/test/tools/llvm-elfabi/Output/fail-file-write.test.tmp.TestDir

14 954.0 --

14 954.0 Exit Code: 2

14 954.0

14 954.0 Command Output (stderr):

14 954.0 --

14 954.0 FileCheck error: '' is empty.

14 954.0 FileCheck command line: /llvm-project/build/bin/FileCheck -DMSG=Permission denied /llvm-project/llvm/test/tools/llvm-elfabi/fail-file-write.test --check-prefix=ERR

14 954.0

14 954.0 --

14 954.0

14 954.0 ****

14 954.0 Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..

14 978.0 ****

14 978.0 Failed Tests (2):

14 978.0 LLVM :: tools/llvm-ar/error-opening-permission.test

14 978.0 LLVM :: tools/llvm-elfabi/fail-file-write.test

14 978.0

14 978.0

14 978.0 Testing Time: 701.78s

14 978.0 Unsupported : 18707

14 978.0 Passed : 52403

14 978.0 Expectedly Failed: 85

14 978.0 Failed : 2

14 978.0

14 978.0 1 warning(s) in tests

14 978.3 FAILED: CMakeFiles/check-all

14 978.3 cd /llvm-project/build && /usr/bin/python3.8 /llvm-project/build/./bin/llvm-lit -sv --param USE_Z3_SOLVER=0 /llvm-project/build/tools/clang/test /llvm-project/build/utils/lit /llvm-project/build/test

14 978.3 ninja: build stopped: subcommand failed.

14 ERROR: executor failed running [/bin/sh -c ninja check]: exit code: 1


[llvm-debug-test 1/1] RUN ninja check:

executor failed running [/bin/sh -c ninja check]: exit code: 1

ChunyuLiao commented 3 years ago

the permission denied error, I think is CI's environmental problem. My result: Testing Time: 387.57s Unsupported : 18707 Passed : 52405 Expectedly Failed: 85

so merge this patch.