public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierrick Philippe <pierrick.philippe@irisa.fr>
To: gcc-help@gcc.gnu.org
Subject: Help about plugins - GIMPLE_COND
Date: Mon, 30 Jan 2023 14:42:04 +0100	[thread overview]
Message-ID: <c14510a3-d776-4632-3eca-3ccfb0cafee9@irisa.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 1446 bytes --]

Hi everyone,

I'm playing around on GCC version 11.3 (build Ubuntu), with plugins and 
passes running on GCC IL, |GIMPLE| in its SSA form to be precise.
But I face an issue with |GIMPLE_COND| statement.

Here is my example statement (output from |debug_gimple_stmt()|):

|if (a_3 == x.0_1) |

Here is the basic bloc containing the statement (dump from 
|gimple_debug_bb()|):

|;; basic block 2, loop depth 0 ;; pred: ENTRY a_3 = 5; # VUSE 
<.MEM_4(D)> x.0_1 = x; if (a_3 == x.0_1) goto <bb 3>; [INV] else goto 
<bb 4>; [INV] ;; succ: 3 ;; 4 |

So, things I'm having trouble with is that when I'm calling 
|gimple_cond_{true,false}_label()| on the |GIMPLE_COND| statement 
(casted through |as_a<gcond*>()|), I get a null pointer for both of 
them, and I do not understand why.

My first intuition is that here |goto|s is not branching on any label 
but on basic bloc directly somehow explain it.
I have been told to use extract_true_false_edges_from_block(), and it do 
works.
Though this is not really what I was expecting as I get an edge and not 
a tree nor a gimple *.
By the way, extract_true_false_edges_from_block() is not mention inside 
the internal documentation, whereas gimple_cond_{true,false}_label() is.

Anyway, my question is regarding the gimple_cond_{true,false}_label() 
function.
I can't find any use case where this function is not returning nullptr, 
so what could be its typical use(s) case(s)?

Cheers,

Pierrick Philippe

                 reply	other threads:[~2023-01-30 13:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c14510a3-d776-4632-3eca-3ccfb0cafee9@irisa.fr \
    --to=pierrick.philippe@irisa.fr \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).