diff options
author | Jeff Greene <hippiehunterenator@gmail.com> | 2018-02-04 04:53:26 +0300 |
---|---|---|
committer | Morgan Brown <morganbr@users.noreply.github.com> | 2018-02-04 04:53:26 +0300 |
commit | e89bb7a087f26031f173ade1f57d01bef7c9f685 (patch) | |
tree | 0b5adc97c77087f56a515d14d4485ceb64179f34 /src/ILCompiler.WebAssembly | |
parent | f19daaae780f2b0b2675792a8b0ef071dc1e58ff (diff) |
Fixed ldind failure and properly zext unsigned types that are smaller than 32bit (#5342)
Diffstat (limited to 'src/ILCompiler.WebAssembly')
-rw-r--r-- | src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs index 1ac1869c3..1e1c20470 100644 --- a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs +++ b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs @@ -395,6 +395,10 @@ namespace Internal.IL { return LLVM.BuildSExtOrBitCast(builder, value, type, "SExtOrBitCast"); } + else if (type.GetIntTypeWidth() > LLVM.TypeOf(value).GetIntTypeWidth()) + { + return LLVM.BuildZExtOrBitCast(builder, value, type, "ZExtOrBitCast"); + } else { Debug.Assert(typeKind == LLVMTypeKind.LLVMIntegerTypeKind); @@ -1569,7 +1573,7 @@ namespace Internal.IL LLVMValueRef pointerElementType = pointer.ValueAsType(type.MakePointerType(), _builder); _stack.Push(new LoadExpressionEntry(type != null ? GetStackValueKind(type) : StackValueKind.ByRef, "ldind", - pointerElementType, type.MakePointerType())); + pointerElementType, type)); } private void ImportStoreIndirect(int token) |