[PATCH] D19210: Teach poison value tracking that certain calls always terminate

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 16:31:35 PDT 2016


sanjoy added inline comments.

================
Comment at: lib/Analysis/ValueTracking.cpp:3288
@@ +3287,3 @@
+    // not contain side effects.  As far as I can tell, this isn't a new
+    // assumption (e.g. we will DCE readnone and readonly calls).
+    return CS.doesNotThrow() && CS.onlyReadsMemory();
----------------
broune wrote:
> This seems unfortunate given that, as I understand it, we then can't compile C11 correctly:
> 
>   http://stackoverflow.com/questions/16436237/is-while1-undefined-behavior-in-c
> 
> Go ahead and submit this if you're sure that the consensus is that this is how LLVM ought to behave. I'd be more comfortable if the langref stated that infinite side-effect free loops are not allowed, but I couldn't find anything about that in there.
I'm going to look at http://stackoverflow.com/questions/16436237/is-while1-undefined-behavior-in-c , but assuming that's accurate (i.e. `while (1);` is well defined) I'll redact this patch.  It's not really an option (IMO) to miscompile C11. :)


http://reviews.llvm.org/D19210





More information about the llvm-commits mailing list