[LLVMdev] readonly and infinite loops
Nuno Lopes
nunoplopes at sapo.pt
Sat Jun 27 14:16:04 PDT 2015
At least in C/C++ that's UB, yes.
Some years ago there was a lot of discussion about this on the ML. Se
Nick's patch, for example:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20100705/103670.html
The patch was eventually dropped, I don't recall why. I think it's fine to
assume that readnone functions always terminate. It would probably fine for
readonly functions as well.
Nuno
-----Original Message-----
From: Sanjoy Das
Sent: Saturday, June 27, 2015 9:29 PM
Subject: [LLVMdev] readonly and infinite loops
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