[llvm-dev] Semantics of udef values in PHI instructions

Charitha Saumya via llvm-dev llvm-dev at lists.llvm.org
Sat Aug 14 18:52:50 PDT 2021


Hi,

Consider the following LLVM IR snippet. (also attached)

the value of %unify.phi is undefined if the loop body (while.body9)  is
executed, otherwise it has some specific value (%c.1 is a defined value).

However when I execute this IR (using lli), the value of %c.2 is always the
value of %c.1, even if the loop is executed multiple times.

What is the reason for this behavior?  how undefined values are handled in
LLVM and is this behaviour architecture dependent (depending on how undef
is handled in Codegen) ?

Thanks
Charitha

[image: Screen Shot 2021-08-14 at 9.36.28 PM.png]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210814/dec5dd7c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2021-08-14 at 9.36.28 PM.png
Type: image/png
Size: 101653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210814/dec5dd7c/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.ll.rtf
Type: text/rtf
Size: 6508 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210814/dec5dd7c/attachment-0001.bin>


More information about the llvm-dev mailing list