When building the Linux kernel with clang on SystemZ, the use of __builtin_constant_p() lead to the error "error: invalid operand for inline asm constraint 'i'". The purpose of this function is to do a compile-time check to see if the argument is constant or not. If it is not, then it should evaluate to false and the (in this case) inline asm statement should be removed.
GVN optimized a conditional branch controlled by a compare with zero. It deduced that in a specific block, the value must be zero since the branch must be taken to reach there. This lead to the non-constant argument (also the compared value) passed to builtin_constant_p() being replaced with a zero in the successor block. This in turn resulted in the inline asm not being removed from the program and thus the error message of "i" being used incorrectly (there were multiple builtin_constant_p calls in the program).
This patch suggest one way of handling this, namely by excluding the llvm.is.constant intrinsic from being optimized by GVN and similar passes...