Currently, clang/llvm handles inline-asm instructions in a very conservative manner, choosing not to eliminate the instructions or hoisting them out of a loop even when it's safe to do so. This patch makes changes to clang to attach a readonly or readnone attribute to an inline-asm instruction, which enables passes such as LICM and EarlyCSE to move or optimize away the instruction.
The patch is based on the patch Chad proposed in 2012:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120430/057131.html
If this patch is approved, I plan to add another test case to check CSE and LICM can remove an inline-asm or hoist it out of a loop if readonly or readnone is attached.