From 5a53c5d1977b0eeade04b53da24f6d75566d28e5 Mon Sep 17 00:00:00 2001
From: Chris Lattner
-
-Where did all of my code go?? -
-If you are using the LLVM demo page, you may often wonder what happened to all -of the code that you typed in. Remember that the demo script is running the -code through the LLVM optimizers, so if your code doesn't actually do anything -useful, it might all be deleted. -
- --To prevent this, make sure that the code is actually needed. For example, if -you are computing some expression, return the value from the function instead of -leaving it in a local variable. If you really want to constrain the optimizer, -you can read from and assign to volatile global variables. -
-What is this llvm.global_ctors and _GLOBAL__I__tmp_webcompile... stuff that happens when I #include <iostream>?
@@ -520,6 +501,51 @@ instead of iostreams to print values.+If you are using the LLVM demo page, you may often wonder what happened to all +of the code that you typed in. Remember that the demo script is running the +code through the LLVM optimizers, so if your code doesn't actually do anything +useful, it might all be deleted. +
+ ++To prevent this, make sure that the code is actually needed. For example, if +you are computing some expression, return the value from the function instead of +leaving it in a local variable. If you really want to constrain the optimizer, +you can read from and assign to volatile global variables. +
++undef is the LLVM way of representing +a value that is not defined. You can get these if you do not initialize a +variable before you use it. For example, the C function:
+ +Is compiled to "ret int undef" because "i" never has a value +specified for it. +
+