[LLVMdev] Obfuscation Transformations Clobbered by Unkown Optimizations

Chris Lattner sabre at nondot.org
Thu Dec 13 18:01:11 PST 2007

On Thu, 13 Dec 2007, Matt Fredrikson wrote:
> After I run opt on an un-obfuscated bitcode file to produce an
> obfuscated bitcode file, I verify that my transformations were placed


> in the file using llvm-dis. At this point, the changes appear to have
> been made. However, if I run the obfuscated bitcode file through llc
> to produce x86 assembly, the obfuscations vanish. I manually disabled

llc does a lot of transformations implicitly, including constant folding, 
as anton says.  There is no way to disable some of these, pieces of the 
code generator work under the assumption that it can generate "foldable" 
constants and that they will get folded.

> all of the suspicious transformation passes run by llc, and nothing
> changes. The same things happens if I run llvm-ld -native
> -disable-opt.
> Does anybody know what pass is clobbering my obfuscations?

If you really want to guarantee that they won't go away, the best thing to 
do is to make an alloca (stack memory) and use volatile load/store 
instructions to access it.



More information about the llvm-dev mailing list