Skip to content

configure doesn't work #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

KaoruToda
Copy link

configure causes the following problem.

checking size of long long... configure: error: in /work/gcc-7.2.0/host-x86_64-pc-linux-gnu/libiberty': configure: error: cannot compute sizeof (long long) See config.log' for more details.

configure causes the following problem.

checking size of long long... configure: error: in `/work/gcc-7.2.0/host-x86_64-pc-linux-gnu/libiberty':
configure: error: cannot compute sizeof (long long)
See `config.log' for more details.
@jwakely
Copy link
Contributor

jwakely commented Feb 12, 2018

This is an unofficial mirror that nobody from the GCC project is involved with. Sending pull requests here is a waste of time.

Please see https://gcc.gnu.org/contribute.html for how to contribute to GCC, thanks.

kraj pushed a commit to kraj/gcc that referenced this pull request Oct 12, 2020
Prevents the following UBSAN error:

./xgcc -B. /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/torture/pr49770.C -O2 -c
/home/marxin/Programming/gcc2/gcc/ipa-modref-tree.h:482:22: runtime error: load of value 2, which is not a valid value for type 'bool'
    #0 0x1fdb4d1 in modref_tree<int>::merge(modref_tree<int>*, vec<modref_parm_map, va_heap, vl_ptr>*) /home/marxin/Programming/gcc2/gcc/ipa-modref-tree.h:482
    #1 0x1fcadaa in merge_call_side_effects(modref_summary*, gimple*, modref_summary*, bool) /home/marxin/Programming/gcc2/gcc/ipa-modref.c:511
    gcc-mirror#2 0x1fcbadd in analyze_call /home/marxin/Programming/gcc2/gcc/ipa-modref.c:642
    gcc-mirror#3 0x1fcc061 in analyze_stmt /home/marxin/Programming/gcc2/gcc/ipa-modref.c:732
    gcc-mirror#4 0x1fccf31 in analyze_function /home/marxin/Programming/gcc2/gcc/ipa-modref.c:823
    gcc-mirror#5 0x1fd17e5 in execute /home/marxin/Programming/gcc2/gcc/ipa-modref.c:1441
    gcc-mirror#6 0x25cca6e in execute_one_pass(opt_pass*) /home/marxin/Programming/gcc2/gcc/passes.c:2509
    gcc-mirror#7 0x25cd39b in execute_pass_list_1 /home/marxin/Programming/gcc2/gcc/passes.c:2597
    gcc-mirror#8 0x25cd450 in execute_pass_list_1 /home/marxin/Programming/gcc2/gcc/passes.c:2598
    gcc-mirror#9 0x25cd4ee in execute_pass_list(function*, opt_pass*) /home/marxin/Programming/gcc2/gcc/passes.c:2608
    gcc-mirror#10 0x25c7a5a in do_per_function_toporder(void (*)(function*, void*), void*) /home/marxin/Programming/gcc2/gcc/passes.c:1726
    gcc-mirror#11 0x25cfa3f in execute_ipa_pass_list(opt_pass*) /home/marxin/Programming/gcc2/gcc/passes.c:2941
    gcc-mirror#12 0x173572d in ipa_passes /home/marxin/Programming/gcc2/gcc/cgraphunit.c:2642
    gcc-mirror#13 0x17364ee in symbol_table::compile() /home/marxin/Programming/gcc2/gcc/cgraphunit.c:2777
    gcc-mirror#14 0x17372d9 in symbol_table::finalize_compilation_unit() /home/marxin/Programming/gcc2/gcc/cgraphunit.c:3022
    gcc-mirror#15 0x2a1f00a in compile_file /home/marxin/Programming/gcc2/gcc/toplev.c:485
    gcc-mirror#16 0x2a27dc8 in do_compile /home/marxin/Programming/gcc2/gcc/toplev.c:2321
    gcc-mirror#17 0x2a283cc in toplev::main(int, char**) /home/marxin/Programming/gcc2/gcc/toplev.c:2460
    gcc-mirror#18 0x54f21cd in main /home/marxin/Programming/gcc2/gcc/main.c:39
    gcc-mirror#19 0x7ffff6f0de09 in __libc_start_main ../csu/libc-start.c:314
    gcc-mirror#20 0x9eac09 in _start (/home/marxin/Programming/gcc2/objdir/gcc/cc1plus+0x9eac09)

gcc/ChangeLog:

	* ipa-modref.c (merge_call_side_effects): Clear modref_parm_map
	fields in the vector.
kraj pushed a commit to kraj/gcc that referenced this pull request Oct 19, 2020
It fixes:

/home/marxin/Programming/gcc2/gcc/ipa-modref-tree.h:482:22: runtime error: load of value 255, which is not a valid value for type 'bool'
    #0 0x18e5df3 in modref_tree<int>::merge(modref_tree<int>*, vec<modref_parm_map, va_heap, vl_ptr>*) /home/marxin/Programming/gcc2/gcc/ipa-modref-tree.h:482
    #1 0x18dc180 in ipa_merge_modref_summary_after_inlining(cgraph_edge*) /home/marxin/Programming/gcc2/gcc/ipa-modref.c:1779
    gcc-mirror#2 0x18c1c72 in inline_call(cgraph_edge*, bool, vec<cgraph_edge*, va_heap, vl_ptr>*, int*, bool, bool*) /home/marxin/Programming/gcc2/gcc/ipa-inline-transform.c:492
    gcc-mirror#3 0x4a3589c in inline_small_functions /home/marxin/Programming/gcc2/gcc/ipa-inline.c:2216
    gcc-mirror#4 0x4a3b230 in ipa_inline /home/marxin/Programming/gcc2/gcc/ipa-inline.c:2697
    gcc-mirror#5 0x4a3d902 in execute /home/marxin/Programming/gcc2/gcc/ipa-inline.c:3096
    gcc-mirror#6 0x1edf831 in execute_one_pass(opt_pass*) /home/marxin/Programming/gcc2/gcc/passes.c:2509
    gcc-mirror#7 0x1ee26af in execute_ipa_pass_list(opt_pass*) /home/marxin/Programming/gcc2/gcc/passes.c:2936
    gcc-mirror#8 0x103f31b in ipa_passes /home/marxin/Programming/gcc2/gcc/cgraphunit.c:2700
    gcc-mirror#9 0x103fb40 in symbol_table::compile() /home/marxin/Programming/gcc2/gcc/cgraphunit.c:2777
    gcc-mirror#10 0x104092b in symbol_table::finalize_compilation_unit() /home/marxin/Programming/gcc2/gcc/cgraphunit.c:3022
    gcc-mirror#11 0x235723b in compile_file /home/marxin/Programming/gcc2/gcc/toplev.c:485
    gcc-mirror#12 0x235fff9 in do_compile /home/marxin/Programming/gcc2/gcc/toplev.c:2321
    gcc-mirror#13 0x23605fc in toplev::main(int, char**) /home/marxin/Programming/gcc2/gcc/toplev.c:2460
    gcc-mirror#14 0x4e2b93b in main /home/marxin/Programming/gcc2/gcc/main.c:39
    gcc-mirror#15 0x7ffff6f0ae09 in __libc_start_main ../csu/libc-start.c:314
    gcc-mirror#16 0x9a0be9 in _start (/home/marxin/Programming/gcc2/objdir/gcc/cc1+0x9a0be9)

gcc/ChangeLog:

	* ipa-modref.c (compute_parm_map): Clear vector.
kraj pushed a commit to kraj/gcc that referenced this pull request Nov 2, 2020
Enable thumb1_gen_const_int to generate RTL or asm depending on the
context, so that we avoid duplicating code to handle constants in
Thumb-1 with -mpure-code.

Use a template so that the algorithm is effectively shared, and
rely on two classes to handle the actual emission as RTL or asm.

The generated sequence is improved to handle right-shiftable and small
values with less instructions. We now generate:

128:
        movs    r0, r0, #128
264:
        movs    r3, gcc-mirror#33
        lsls    r3, gcc-mirror#3
510:
        movs    r3, #255
        lsls    r3, #1
512:
        movs    r3, #1
        lsls    r3, gcc-mirror#9
764:
        movs    r3, #191
        lsls    r3, gcc-mirror#2
65536:
        movs    r3, #1
        lsls    r3, gcc-mirror#16
0x123456:
        movs    r3, gcc-mirror#18 ;0x12
        lsls    r3, gcc-mirror#8
        adds    r3, gcc-mirror#52 ;0x34
        lsls    r3, gcc-mirror#8
        adds    r3, gcc-mirror#86 ;0x56
0x1123456:
        movs    r3, #137 ;0x89
        lsls    r3, gcc-mirror#8
        adds    r3, gcc-mirror#26 ;0x1a
        lsls    r3, gcc-mirror#8
        adds    r3, gcc-mirror#43 ;0x2b
        lsls    r3, #1
0x1000010:
        movs    r3, gcc-mirror#16
        lsls    r3, gcc-mirror#16
        adds    r3, #1
        lsls    r3, gcc-mirror#4
0x1000011:
        movs    r3, #1
        lsls    r3, gcc-mirror#24
        adds    r3, gcc-mirror#17
-8192:
	movs	r3, #1
	lsls	r3, gcc-mirror#13
	rsbs	r3, #0

The patch adds a testcase which does not fully exercise
thumb1_gen_const_int, as other existing patterns already catch small
constants.  These parts of thumb1_gen_const_int are used by
arm_thumb1_mi_thunk.

2020-11-02  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/
	* config/arm/arm.c (thumb1_const_rtl, thumb1_const_print): New
	classes.
	(thumb1_gen_const_int): Rename to ...
	(thumb1_gen_const_int_1): ... New helper function. Add capability
	to emit either RTL or asm, improve generated code.
	(thumb1_gen_const_int_rtl): New function.
	* config/arm/arm-protos.h (thumb1_gen_const_int): Rename to
	thumb1_gen_const_int_rtl.
	* config/arm/thumb1.md: Call thumb1_gen_const_int_rtl instead
	of thumb1_gen_const_int.

	gcc/testsuite/
	* gcc.target/arm/pure-code/no-literal-pool-m0.c: New.
fxcoudert pushed a commit to fxcoudert/gcc that referenced this pull request May 4, 2021
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.
nstester pushed a commit to nstester/gcc that referenced this pull request Jun 14, 2021
The fixed error is:

==21166==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x60300000d900
    #0 0x7367d7 in operator delete(void*, unsigned long) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/libsanitizer/asan/asan_new_delete.cpp:172
    #1 0x3b82e6e in pointer_equiv_analyzer::~pointer_equiv_analyzer() /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/gimple-ssa-evrp.c:161
    #2 0x3b83387 in hybrid_folder::~hybrid_folder() /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/gimple-ssa-evrp.c:517
    #3 0x3b83387 in execute_early_vrp /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/gimple-ssa-evrp.c:686
    #4 0x1790611 in execute_one_pass(opt_pass*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/passes.c:2567
    gcc-mirror#5 0x1792003 in execute_pass_list_1 /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/passes.c:2656
    gcc-mirror#6 0x1792029 in execute_pass_list_1 /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/passes.c:2657
    gcc-mirror#7 0x179209f in execute_pass_list(function*, opt_pass*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/passes.c:2667
    gcc-mirror#8 0x178a5f3 in do_per_function_toporder(void (*)(function*, void*), void*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/passes.c:1773
    gcc-mirror#9 0x1792fac in do_per_function_toporder(void (*)(function*, void*), void*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/plugin.h:191
    gcc-mirror#10 0x1792fac in execute_ipa_pass_list(opt_pass*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/passes.c:3001
    gcc-mirror#11 0xc525fc in ipa_passes /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/cgraphunit.c:2154
    gcc-mirror#12 0xc525fc in symbol_table::compile() /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/cgraphunit.c:2289
    gcc-mirror#13 0xc5a096 in symbol_table::compile() /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/cgraphunit.c:2269
    gcc-mirror#14 0xc5a096 in symbol_table::finalize_compilation_unit() /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/cgraphunit.c:2537
    gcc-mirror#15 0x1a7a17c in compile_file /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/toplev.c:482
    gcc-mirror#16 0x69c758 in do_compile /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/toplev.c:2210
    gcc-mirror#17 0x69c758 in toplev::main(int, char**) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/toplev.c:2349
    gcc-mirror#18 0x6a932a in main /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/main.c:39
    gcc-mirror#19 0x7ffff7820b34 in __libc_start_main ../csu/libc-start.c:332
    gcc-mirror#20 0x6aa5fd in _start (/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/objdir/gcc/cc1+0x6aa5fd)

0x60300000d900 is located 0 bytes inside of 32-byte region [0x60300000d900,0x60300000d920)
allocated by thread T0 here:
    #0 0x735ab7 in operator new[](unsigned long) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/libsanitizer/asan/asan_new_delete.cpp:102
    #1 0x3b82dac in pointer_equiv_analyzer::pointer_equiv_analyzer(gimple_ranger*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/gimple-ssa-evrp.c:156

gcc/ChangeLog:

	* gimple-ssa-evrp.c (pointer_equiv_analyzer::~pointer_equiv_analyzer): Use delete[].
mablinov pushed a commit to mablinov/gcc that referenced this pull request Oct 29, 2021
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.
mablinov pushed a commit to mablinov/gcc that referenced this pull request Nov 10, 2021
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.
fxcoudert pushed a commit to fxcoudert/gcc that referenced this pull request Nov 23, 2021
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.
@nexos-dev
Copy link

Not only is this just a mirror, configure is generated by autoconf. A patch should be sent to their mailing list instead.
configure shouldn't ever be changed directly

catap pushed a commit to catap/gcc that referenced this pull request Feb 22, 2022
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.

(cherry picked from commit 78ccb496faa54d0e87540b97a540ed63087bc953)
markmentovai pushed a commit to markmentovai/gcc that referenced this pull request Jun 13, 2022
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.
xionghul pushed a commit to xionghul/gcc that referenced this pull request Jun 24, 2022
This patch addresses PR target/105930 which is an ia32 stack frame size
regression in high-register pressure XOR-rich cryptography functions
reported by Linus Torvalds.  The underlying problem is once the limited
number of registers on the x86 are exhausted, the register allocator
has to decide which to spill, where some eviction choices lead to much
poorer code, but these consequences are difficult to predict in advance.

The patch below, which splits xordi3_doubleword and iordi3_doubleword
after reload (instead of before), significantly reduces the amount of
spill code and stack frame size, in what might appear to be an arbitrary
choice.

My explanation of this behaviour is that the mixing of pre-reload split
SImode instructions and post-reload split DImode instructions is
confusing some of the heuristics used by reload.  One might think
that splitting early gives the register allocator more freedom to
use available registers, but in practice the constraint that double
word values occupy consecutive registers (when ultimately used as a
DImode value) is the greater constraint.  Instead, I believe in this
case, the pseudo registers used in memory addressing, appear to be
double counted for split SImode instructions compared to unsplit
DImode instructions.  For the reduced test case in comment gcc-mirror#13, this
leads to %eax being used to hold the long-lived argument pointer "v",
blocking the use of the ax:dx pair for processing double word values.
The important lines are at the very top of the assembly output:

GCC 11	[use %ecx to address memory, require a 24-byte stack frame]
        sub     esp, 24
        mov     ecx, DWORD PTR [esp+40]

GCC 12 [use %eax to address memory, require a 44-byte stack frame]
        sub     esp, 44
        mov     eax, DWORD PTR [esp+64]

2022-06-24  Roger Sayle  <roger@nextmovesoftware.com>
	    Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog
	PR target/105930
	* config/i386/i386.md (*<any_or>di3_doubleword): Split after
	reload.  Use rtx_equal_p to avoid creating memory-to-memory moves,
	and emit NOTE_INSN_DELETED if operand[2] is zero (i.e. with -O0).
catap pushed a commit to catap/gcc that referenced this pull request May 3, 2023
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.

(cherry picked from commit 78ccb496faa54d0e87540b97a540ed63087bc953)
catap pushed a commit to catap/gcc that referenced this pull request May 3, 2023
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.

(cherry picked from commit 78ccb496faa54d0e87540b97a540ed63087bc953)
catap pushed a commit to catap/gcc that referenced this pull request May 3, 2023
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.

(cherry picked from commit 78ccb496faa54d0e87540b97a540ed63087bc953)
catap pushed a commit to catap/gcc that referenced this pull request May 3, 2023
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.

(cherry picked from commit 78ccb496faa54d0e87540b97a540ed63087bc953)
catap pushed a commit to catap/gcc that referenced this pull request May 3, 2023
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.

(cherry picked from commit 78ccb496faa54d0e87540b97a540ed63087bc953)
catap pushed a commit to catap/gcc that referenced this pull request May 4, 2023
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.

(cherry picked from commit 78ccb496faa54d0e87540b97a540ed63087bc953)
catap pushed a commit to catap/gcc that referenced this pull request May 4, 2023
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.

(cherry picked from commit 78ccb496faa54d0e87540b97a540ed63087bc953)
Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
catap pushed a commit to catap/gcc that referenced this pull request Nov 12, 2023
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.

(cherry picked from commit 78ccb496faa54d0e87540b97a540ed63087bc953)
Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
catap pushed a commit to catap/gcc that referenced this pull request Nov 14, 2023
Section anchors are tricky with the ld64 atom model.  It is possible
to make them work in a sub-set of circumstances.

TODO: determine those cases and apply fixes to deal with them.

This fixes issue gcc-mirror#13.

(cherry picked from commit 78ccb496faa54d0e87540b97a540ed63087bc953)
Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
hubot pushed a commit that referenced this pull request May 7, 2024
vsetvli local eliminate is only consider the current demand instead of
full demand, and it will use that incomplete info to remove vsetvli.

Give following example from PR114747:

vsetvli a5,a1,e8,m4,ta,mu       # 57, ratio=2, sew=8, lmul=4
vsetvli zero,a5,e16,m8,ta,ma    # 58, ratio=2, sew=16, lmul=8
vle8.v  v8,0(a0)        # 13, demand ratio=2
vzext.vf2       v24,v8  # 14, demand sew=16 and lmul=8

Insn #58 will removed because #57 has satisfied demand of #13, but it's
not consider #14.

It should doing more demand analyze, but this bug only present in GCC 13
branch, and we should not change too much on this release branch, so the best
way is make the check more conservative - remove only if the target
vsetvl_discard_result having same SEW and LMUL as the source vsetvli.

gcc/ChangeLog:

	PR target/114747
	* config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn):
	Check target vsetvl_discard_result and source vsetvli has same
	SEW and LMUL.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/pr114747.c: New.
Frosty515 pushed a commit to FrostyOS-dev/gcc that referenced this pull request May 23, 2024
vsetvli local eliminate is only consider the current demand instead of
full demand, and it will use that incomplete info to remove vsetvli.

Give following example from PR114747:

vsetvli a5,a1,e8,m4,ta,mu       # 57, ratio=2, sew=8, lmul=4
vsetvli zero,a5,e16,m8,ta,ma    # 58, ratio=2, sew=16, lmul=8
vle8.v  v8,0(a0)        # 13, demand ratio=2
vzext.vf2       v24,v8  # 14, demand sew=16 and lmul=8

Insn gcc-mirror#58 will removed because gcc-mirror#57 has satisfied demand of gcc-mirror#13, but it's
not consider gcc-mirror#14.

It should doing more demand analyze, but this bug only present in GCC 13
branch, and we should not change too much on this release branch, so the best
way is make the check more conservative - remove only if the target
vsetvl_discard_result having same SEW and LMUL as the source vsetvli.

gcc/ChangeLog:

	PR target/114747
	* config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn):
	Check target vsetvl_discard_result and source vsetvli has same
	SEW and LMUL.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/pr114747.c: New.
NinaRanns referenced this pull request in NinaRanns/gcc Jul 9, 2024
update trunk to r15-1804-g2be2145f4f14a7
hubot pushed a commit that referenced this pull request Oct 3, 2024
GCC currently supports outputting SARIF v2.1.0

Version 2.2 of the SARIF spec is not yet official, but the draft has
already gained features we might might want to use.

This patch extends the SARIF output code to accept a enum sarif_version
parameter internally, representing 2.1.0 or a prerelease of 2.2

The patch updates the SARIF output selftests so that they are run for
all such versions.

I hope to expose this "properly" via the mechanism described
in comment #13 of PR116613.  In the meantime, the patch adds a new
  -fdiagnostics-format=sarif-file-2.2-prerelease
for use by the DejaGnu testsuite, deliberately left undocumented for
now.

The copy of the 2.2 draft schema in the testsuite was downloaded from
https://raw.githubusercontent.com/oasis-tcs/sarif-spec/refs/tags/2.2-prerelease-2024-08-08/sarif-2.2/schema/sarif-2-2.schema.json

The patch adds support for capturing related locations within an ICE
notification for SARIF 2.2 onwards, thus capturing "include chain"
information for SARIF-based reports of ICEs that occur within a
header; see oasis-tcs/sarif-spec#540

The patch does *not* add support for the "scannedFile" role, leaving it
to followup work; see oasis-tcs/sarif-spec#459

gcc/ChangeLog:
	PR other/116301
	* common.opt (sarif-file-2.2-prerelease): New value for
	-fdiagnostics-format=.
	* diagnostic-format-sarif.cc
	(sarif_location_manager::sarif_location_manager): Move
	initialization of m_related_locations_arr here from sarif_result's
	ctor.
	(sarif_location_manager::add_related_location): Implement for
	base class, taking sarif_result's implementation.  Add "builder"
	param.
	(sarif_location_manager::m_related_locations_arr): Move here from
	class sarif_result.
	(class sarif_result): Move m_related_locations_arr field and
	add_related_location vfunc to class sarif_location_manager.
	(sarif_builder::get_version): New accessor.
	(sarif_builder::m_version): New field.
	(sarif_invocation::add_notification_for_ice): Call
	process_worklist on the notification for SARIF 2.2 and later.
	(sarif_location_manager::process_worklist_item): Pass builder to
	calls to add_related_location.
	(sarif_result::on_nested_diagnostic): Likewise.
	(sarif_result::on_diagram): Likewise.
	(sarif_ice_notification::add_related_location): Add builder param.
	For SARIF 2.2 and later chain up to base class impl so that
	notifications get related locations.
	(sarif_builder::sarif_builder): Add "version" param.
	(SARIF_SCHEMA): Delete in favor of...
	(sarif_version_to_url): New function.
	(SARIF_VERSION): Delete in favor of...
	(sarif_version_to_property): New function.
	(make_top_level_object): Update to use m_version for "$schema" and
	"version".
	(sarif_output_format::sarif_output_format): Add "version" param.
	(sarif_stream_output_format::sarif_stream_output_format):
	Likewise.
	(sarif_file_output_format::sarif_file_output_format): Likewise.
	(diagnostic_output_format_init_sarif_stderr): Likewise.
	(diagnostic_output_format_init_sarif_file): Likewise.
	(diagnostic_output_format_init_sarif_stream): Likewise.
	(selftest::test_sarif_diagnostic_context): Likewise.
	(selftest::test_make_location_object): Likewise.
	(selftest::test_simple_log): Likewise.  Update schema and version
	tests accordingly.
	(selftest::test_simple_log_2): Add "version" param.
	(selftest::test_message_with_embedded_link): Likewise.
	(selftest::run_tests_per_version): New, based on the
	for_each_line_table_case calls in...
	(selftest::diagnostic_format_sarif_cc_tests): Add loop over sarif
	versions.  Replace for_each_line_table_case calls with one
	call to run_tests_per_version.
	* diagnostic-format-sarif.h: Include "diagnostic-format.h".
	(enum class sarif_version): New.
	(diagnostic_output_format_init_sarif_stderr): Move to here from
	diagnostic-format.h.  Add "version" param.
	(diagnostic_output_format_init_sarif_file): Likewise.
	(diagnostic_output_format_init_sarif_stream): Likewise.
	* diagnostic-format.h: Include "diagnostic.h".
	(diagnostic_output_format_init_sarif_stderr): Move from here to
	diagnostic-format-sarif.h.
	* diagnostic.cc: Define INCLUDE_MEMORY.
	Include "diagnostic-format-sarif.h".
	(diagnostic_output_format_init): Pass sarif_version::v2_1_0 to
	existing SARIF options.
	Add case DIAGNOSTICS_OUTPUT_FORMAT_SARIF_FILE_2_2_PRERELEASE.
	* diagnostic.h (enum diagnostics_output_format): Add
	DIAGNOSTICS_OUTPUT_FORMAT_SARIF_FILE_2_2_PRERELEASE.

gcc/testsuite/ChangeLog:
	PR other/116301
	* gcc.dg/plugin/crash-test-ice-in-header-sarif-2.1.c: New test.
	* gcc.dg/plugin/crash-test-ice-in-header-sarif-2.2.c: New test.
	* gcc.dg/plugin/crash-test-ice-in-header-sarif-2_1.py: Support
	script for new test.
	* gcc.dg/plugin/crash-test-ice-in-header-sarif-2_2.py: Likewise.
	* gcc.dg/plugin/crash-test-ice-in-header.h: New header.
	* gcc.dg/plugin/plugin.exp: Add the new tests.
	* lib/sarif-schema-2.2-prerelease-2024-08-08.json: New schema
	file.
	* lib/scansarif.exp (verify-sarif-file): Add optional argument for
	specifying which version of the schema to validate against,
	supporting "2.1" and "2.2", defaulting to the former.
	Update the test name to capture the version of the schema tested
	against.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
MBeijer pushed a commit to AmigaPorts/gcc that referenced this pull request Jun 6, 2025
vsetvli local eliminate is only consider the current demand instead of
full demand, and it will use that incomplete info to remove vsetvli.

Give following example from PR114747:

vsetvli a5,a1,e8,m4,ta,mu       # 57, ratio=2, sew=8, lmul=4
vsetvli zero,a5,e16,m8,ta,ma    # 58, ratio=2, sew=16, lmul=8
vle8.v  v8,0(a0)        # 13, demand ratio=2
vzext.vf2       v24,v8  # 14, demand sew=16 and lmul=8

Insn gcc-mirror#58 will removed because gcc-mirror#57 has satisfied demand of gcc-mirror#13, but it's
not consider gcc-mirror#14.

It should doing more demand analyze, but this bug only present in GCC 13
branch, and we should not change too much on this release branch, so the best
way is make the check more conservative - remove only if the target
vsetvl_discard_result having same SEW and LMUL as the source vsetvli.

gcc/ChangeLog:

	PR target/114747
	* config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn):
	Check target vsetvl_discard_result and source vsetvli has same
	SEW and LMUL.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/pr114747.c: New.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants