[LLVMdev] readonly and infinite loops

Sanjoy Das
Sat, 27 Jun 2015 20:29:42 -0000

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