[llvm-bugs] [Bug 122602] [LoopVectorize] Miscompilation
Issue 122602 Summary [LoopVectorize] Miscompilation Labels miscompilation, loopoptim, vectorizers Assignees Reporter dtcxzyw Reproducer: https://alive2.llvm.org/ce/z/PASME7 ``` ; bin/opt -passes=loop-vectorize reduced.ll -S -o opt.ll target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @e = global [1 x [4 x i16]] zeroinitializer @crc32_tab = global [256 x i32] zeroinitializer define i32 @src() { entry: store i32 1, ptr @crc32_tab, align 4 br label %for.cond4.preheader.outer.i.i.split for.cond4.preheader.outer.i.i.split: ; preds = %for.cond4.preheader.outer.i.i.split, %entry %0 = phi i64 [ %1, %for.cond4.preheader.outer.i.i.split ], [ 3, %entry ] %indvars.iv.i.i23 = phi i64 [ %indvars.iv.next.i.i, %for.cond4.preheader.outer.i.i.split ], [ 2, %entry ] %arrayidx9.i.i = getelementptr i16, ptr @e, i64 %0 store i16 1, ptr %arrayidx9.i.i, align 2 %indvars.iv.next.i.i = add i64 %indvars.iv.i.i23, -1 %tobool7.not.i.i = icmp eq i64 %indvars.iv.next.i.i, 0 %1 = add i64 %indvars.iv.next.i.i, 1 br i1 %tobool7.not.i.i, label %for.end.thread.i.i.1, label %for.cond4.preheader.outer.i.i.split for.end.thread.i.i.1: ; preds = %for.cond4.preheader.outer.i.i.split %arrayidx947.i.i = getelementptr i16, ptr @e, i64 %1 store i16 0, ptr %arrayidx947.i.i, align 2 br label %for.body3 for.body3: ; preds = %for.body3, %for.end.thread.i.i.1 %indvars.iv = phi i64 [ 0, %for.end.thread.i.i.1 ], [ %indvars.iv.next, %for.body3 ] %xor2.i70.i.i1718 = phi i32 [ 0, %for.end.thread.i.i.1 ], [ %3, %for.body3 ] %arrayidx5 = getelementptr i16, ptr @e, i64 %indvars.iv %2 = load i16, ptr %arrayidx5, align 2 %conv = zext i16 %2 to i64 %idxprom.i.i.i = and i64 %conv, 1 %arrayidx.i.i.i = getelementptr i32, ptr @crc32_tab, i64 %idxprom.i.i.i %3 = load i32, ptr %arrayidx.i.i.i, align 4 %indvars.iv.next = add i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, 4 br i1 %exitcond.not, label %for.end8, label %for.body3 for.end8: ; preds = %for.body3 ret i32 %xor2.i70.i.i1718 } ``` ``` > bin/lli reduced.ll > echo $? 0 > bin/lli opt.ll > echo $? 1 ``` llvm version: ab9a80a3ad78f611fd06cd6f7215bd828809310c ___ llvm-bugs mailing list llvm-bugs@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs
[llvm-bugs] [Bug 122592] [clang-tidy] Add ClassIgnoreList option to misc-const-correctness
Issue 122592 Summary [clang-tidy] Add ClassIgnoreList option to misc-const-correctness Labels clang-tidy Assignees Reporter vbvictor Sometimes in large codebases we want to ignore const-correctness of certain classes because they are immutable by nature, so there is no point in adding const to them. Minimal example: ```cpp #include int main() { std::mutex m; std::lock_guard l(m); // check is triggered but we want to ignore it since lock_guard is already immutable. } ``` Writing NOLINT for thousands of places bloats code and is not an appealing option. ___ llvm-bugs mailing list llvm-bugs@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs
[llvm-bugs] [Bug 122584] clang crashes on valid code at -O{s, 2, 3} on x86_64-linux-gnu: Assertion `I1 == PoisonMaskElem && "Expected unused subvectors mask"' failed
Issue 122584 Summary clang crashes on valid code at -O{s,2,3} on x86_64-linux-gnu: Assertion `I1 == PoisonMaskElem && "Expected unused subvectors mask"' failed Labels clang Assignees Reporter zhendongsu It appears to be a recent regression as it doesn't reproduce with 19.1.0 and earlier. Compiler Explorer: https://godbolt.org/z/vWPhsMfoz ``` [510] % clangtk -v clang version 20.0.0git (https://github.com/llvm/llvm-project.git 24bd9bc0b59d51c82e9a4d84c21d86d58d0ef6ce) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /local/home/suz/suz-local/software/local/clang-trunk/bin Build config: +assertions Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12 Candidate multilib: .;@m64 Selected multilib: .;@m64 Found CUDA installation: /usr/local/cuda, version 12.1 [511] % [511] % clangtk -O2 small.c clang-20: /local/suz-local/software/clangbuild/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10936: llvm::InstructionCost llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::finalize(llvm::ArrayRef, llvm::ArrayRef >, llvm::ArrayRef, unsigned int, llvm::function_ref&)>): Assertion `I1 == PoisonMaskElem && "Expected unused subvectors mask"' failed. PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script. Stack dump: 0. Program arguments: /local/home/suz/suz-local/software/local/clang-trunk/bin/clang-20 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name small.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/local/suz-local/software/emitesting/bugs/20250111-clangtk-m64-Os-build-025751/delta -fcoverage-compilation-dir=/local/suz-local/software/emitesting/bugs/20250111-clangtk-m64-Os-build-025751/delta -resource-dir /local/home/suz/suz-local/software/local/clang-trunk/lib/clang/20 -I /usr/local/include -I /local/suz-local/software/local/include -internal-isystem /local/home/suz/suz-local/software/local/clang-trunk/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/small-2771d7.o -x c small.c 1. parser at end of file 2. Optimizer 3. Running pass "function(float2int,lower-constant-intrinsics,loop(loop-rotate,loop-deletion),loop-distribute,inject-tli-mappings,loop-vectorize,infer-alignment,loop-load-elim,instcombine,simplifycfg,slp-vectorizer,vector-combine,instcombine,loop-unroll,transform-warning,sroa,infer-alignment,instcombine,loop-mssa(licm),alignment-from-assumptions,loop-sink,instsimplify,div-rem-pairs,tailcallelim,simplifycfg)" on module "small.c" 4. Running pass "slp-vectorizer" on function "main" #0 0x562bd646d500 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-20+0x4576500) #1 0x562bd646a91f llvm::sys::RunSignalHandlers() (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-20+0x457391f) #2 0x562bd646aa75 SignalHandler(int) Signals.cpp:0:0 #3 0x7f13d1771520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #4 0x7f13d17c5a7c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x96a7c) #5 0x7f13d1771476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476) #6 0x7f13d17577f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3) #7 0x7f13d175771b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b) #8 0x7f13d1768e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96) #9 0x562bd7f25a4f llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator::finalize(llvm::ArrayRef, llvm::ArrayRef>, llvm::ArrayRef, unsigned int, llvm::function_ref&)>) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-20+0x602ea4f) #10 0x562bd7f9164b llvm::InstructionCost llvm::slpvectorizer::BoUpSLP::processBuildVector, llvm::slpvectorizer::BoUpSLP, llvm::SmallPtrSetImpl>(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::Type*, llvm::TargetTransformInfo&, llvm::ArrayRef&, llvm::slpvectorizer::BoUpSLP&,
[llvm-bugs] [Bug 122624] [AArch64] Failure to CSE `add` with commuted `adds`
Issue 122624 Summary [AArch64] Failure to CSE `add` with commuted `adds` Labels backend:AArch64, missed-optimization Assignees Reporter Kmeakin https://godbolt.org/z/zxfEn17d8 The code for `u32::checked_add()` produces two `add`s on AArch64: ```rust pub fn checked_add(x: u32, y: u32) -> Option { x.checked_add(y) } ``` ```asm example::checked_add::h2758207837cc4075: cmn w0, w1 add w1, w1, w0 csetw8, lo mov w0, w8 ret ``` `cmn` is an alias for `adds wzr, w0, w1`. And since `add` is commutative, it should be CSE'd with the next instruction, to give: ```asm example::checked_add::h2758207837cc4075: addsw1, w1, w0 csetw8, lo mov w0, w8 ret ``` The same issue does not occur on x86_64 or RISC-V ___ llvm-bugs mailing list llvm-bugs@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs
[llvm-bugs] [Bug 122631] Request Commit Access For Sharjeel-Khan
Issue 122631 Summary Request Commit Access For Sharjeel-Khan Labels infra:commit-access-request Assignees Reporter Sharjeel-Khan ### Why Are you requesting commit access ? I recently joined Android LLVM toolchain team at Google. I need commit access to land PRs myself after approval for Android changes. ___ llvm-bugs mailing list llvm-bugs@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs
[llvm-bugs] [Bug 122612] [clangd] Add an option to disable special handling of stanadard library code
Issue 122612 Summary [clangd] Add an option to disable special handling of stanadard library code Labels enhancement, clangd Assignees Reporter philnik777 While there are good reasons for adding some special magic for standard libraries, this really gets in the way when actually working on a standard library. For example, the include cleaner is completely broken, since it's always mapping public symbols to the public headers, even though library-internal headers should actually be used. It would be awesome if there was a flag for clangd to disable such special magic, allowing it to be used when working on a standard library without patching your own version together. ___ llvm-bugs mailing list llvm-bugs@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs
[llvm-bugs] [Bug 122616] MCA fails to parse movsx intsructions
Issue 122616 Summary MCA fails to parse movsx intsructions Labels new issue Assignees Reporter TiborGY See: https://gcc.godbolt.org/z/z4nWWTj6E Trying to analyze some assembly from gfortran results in errors when MCA sees some movsx instructions: ``` :105:2: error: invalid operand for instruction movsx rax, r10d ^ :253:2: error: invalid operand for instruction movsx rdi, esi ``` ___ llvm-bugs mailing list llvm-bugs@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs