[llvm-dev] In ISel, where Constant<0> comes from?

Gleb Popov via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 17 06:08:30 PST 2018


Hello, LLVM devs.

I'm compiling the following simple IR:

define dso_local i32 @main(i32 %argc, i8** %argv) {
entry:
  %retval = alloca i32, align 4
  %argc.addr = alloca i32, align 4
  %argv.addr = alloca i8**, align 8
  store i32 0, i32* %retval, align 4
  store i32 %argc, i32* %argc.addr, align 4
  store i8** %argv, i8*** %argv.addr, align 8
  ret i32 0
}

using `llc -march=sparc -debug-only=isel`.

In the Initial selection DAG I see

t19: ch,glue = CopyToReg t17, Register:i32 $i0, Constant:i32<0>

line. The same "Constant:i32<0>" node I see in my toy backend, which forces
me to add a pattern that lowers it using "xor reg,reg". Much like "or
g0,g0" pattern in SPARC.

However, I don't see that Constant node when compiling using X86 backend.
How does it achieve this? And why initial DAGs are different at all? I got
impression that initial DAG is fully target-independent, so these DAG
should be the same before starting ISel. Am I wrong?

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181217/d1b5f551/attachment.html>


More information about the llvm-dev mailing list