Skip to content

Instantly share code, notes, and snippets.

@soimort
Last active December 15, 2015 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soimort/5336465 to your computer and use it in GitHub Desktop.
Save soimort/5336465 to your computer and use it in GitHub Desktop.
gcc "-fipa-pure-const" optimization
--- a1.s 2013-04-08 14:46:49.996856646 +0200
+++ a2.s 2013-04-08 14:46:23.800190673 +0200
@@ -91,7 +91,9 @@
movl $.LC0, %edi
movl $0, %eax
call printf
- movl %ebx, %esi
+ movl $0, %eax
+ call foo
+ movl %eax, %esi
movl $.LC1, %edi
movl $0, %eax
call printf
@soimort
Copy link
Author

soimort commented Apr 8, 2013

Regarding https://gist.github.com/innocentim/5335682:

compile with

$ gcc -O1 -o a1.s -S a.c

and

$ gcc -O1 -fno-ipa-pure-const -o a2.s -S a.c
$ diff -u a1.s a2.s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment