[LLVMdev] readonly and infinite loops

Sanjoy Das sanjoy at playingwithpointers.com
Sat Jun 27 13:29:42 PDT 2015


Running -early-cse on

declare void @rn() readnone nounwind

define void @f() {
 entry:
  call void @rn()
  ret void
}

removes the call to @rn().  But @rn() could have had an infinite loop
in it in which case @f() went from being a non-terminating
program to an terminating no-op.  Is this intentional?

The only way I can see this transform being legal is if infinite loops
are declared to have undefined behavior, but I could not find anything
in the LLVM specification that mentions this.

-- Sanjoy



More information about the llvm-dev mailing list