pcwang-thead added a comment. In D70401#4409782 <https://reviews.llvm.org/D70401#4409782>, @david-sawatzke wrote:
> Hey I've tried using this patch (roughly following > https://noxim.xyz/blog/rust-ch32v003/). > > It uses the older version of this patch for the rust llvm version (here the > llvm tree https://github.com/Noxime/llvm-project/tree/rv32e) and I use rust > commit 0939ec13 (together with the small patch for the RVE). > > I've experience some issues that results in corruption of $sp, the following > is the smallest reproduction (hopefully small enough): > Code: > > rust > #![no_std] > > pub fn test() { > } > > which, with the following .ll for release builds: > > source_filename = "miscomp_repro.8b6a426d3b54bd13-cgu.0" > target datalayout = "e-m:e-p:32:32-i64:64-n32-S128" > target triple = "riscv32" > > define dso_local void @_ZN13miscomp_repro4test17h065760f827b95d43E() > unnamed_addr #0 { > start: > ret void > } > > attributes #0 = { mustprogress nofree norecurse nosync nounwind readnone > willreturn "target-cpu"="generic-rv32" "target-features"="+e,+c" } > > results in this assembly: > > .text > .attribute 4, 4 > .attribute 5, "rv32e1p9_c2p0" > .file "miscomp_repro.8b6a426d3b54bd13-cgu.0" > .section > .text._ZN13miscomp_repro4test17h065760f827b95d43E,"ax",@progbits > .globl _ZN13miscomp_repro4test17h065760f827b95d43E > .p2align 1 > .type _ZN13miscomp_repro4test17h065760f827b95d43E,@function > _ZN13miscomp_repro4test17h065760f827b95d43E: > mv sp, s0 > ret > .Lfunc_end0: > .size _ZN13miscomp_repro4test17h065760f827b95d43E, > .Lfunc_end0-_ZN13miscomp_repro4test17h065760f827b95d43E > > .section ".note.GNU-stack","",@progbits > > Since s0 isn't required to have any specific contents (and in the larger > project this was extracted from doesn't), this corrupts the stack pointer. > Large functions using the stack first save sp to 0, so not all functions > have this issue. This also happens (but more verbose) in debug builds, but > works fine with the exact same toolchain using the riscv32i target. > > Here is the repro with some further output, I hope this patch and not > something else is to blame (if so, sorry in advance). > > F27877626: miscomp_repro.zip <https://reviews.llvm.org/F27877626> Thanks for reporting this. I tried to compile your .ll on my local machine with newest patch, I didn't see the problem. I don't know if it is the bug in older version of this patch, so I suggest you to update the patch and try again. :-) By the way, you can provide the log when you compile the .ll with `-mllvm -print-after-all` option (and `-mllvm -debug` if your llvm is a debug build). It can be helpful for me to figure out which part is wrong. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D70401/new/ https://reviews.llvm.org/D70401 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits