From https://github.com/erikd/ghc-llvm-next/blob/llvm-3.8/patches/01-bitcast.patch diff -u -r ../ghc-8.0.1/compiler/llvmGen/Llvm/PpLlvm.hs ./compiler/llvmGen/Llvm/PpLlvm.hs --- ../ghc-8.0.1/compiler/llvmGen/Llvm/PpLlvm.hs 2016-05-16 13:08:53.000000000 -0400 +++ ./compiler/llvmGen/Llvm/PpLlvm.hs 2016-06-23 16:59:36.113778783 -0400 @@ -73,7 +73,7 @@ Nothing -> empty rhs = case dat of - Just stat -> ppr stat + Just stat -> pprSpecialStatic stat Nothing -> ppr (pLower $ getVarType var) -- Position of linkage is different for aliases. diff -u -r ../ghc-8.0.1/compiler/llvmGen/Llvm/Types.hs ./compiler/llvmGen/Llvm/Types.hs --- ../ghc-8.0.1/compiler/llvmGen/Llvm/Types.hs 2016-05-16 13:08:53.000000000 -0400 +++ ./compiler/llvmGen/Llvm/Types.hs 2016-06-23 17:00:14.569166114 -0400 @@ -175,6 +175,11 @@ ppr (LMSub s1 s2) = pprStaticArith s1 s2 (sLit "sub") (sLit "fsub") "LMSub" +pprSpecialStatic :: LlvmStatic -> SDoc +pprSpecialStatic (LMBitc v t) = + ppr (pLower t) <> text ", bitcast (" <> ppr v <> text " to " <> ppr t <> char ')' +pprSpecialStatic stat = ppr stat + pprStaticArith :: LlvmStatic -> LlvmStatic -> LitString -> LitString -> String -> SDoc pprStaticArith s1 s2 int_op float_op op_name = let ty1 = getStatType s1