[llvm] r257655 - [WebAssembly] MCFixupKindInfo's TargetSize is in bits rather than bytes.
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 13 11:29:37 PST 2016
Author: djg
Date: Wed Jan 13 13:29:37 2016
New Revision: 257655
URL: http://llvm.org/viewvc/llvm-project?rev=257655&view=rev
Log:
[WebAssembly] MCFixupKindInfo's TargetSize is in bits rather than bytes.
Modified:
llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyAsmBackend.cpp
llvm/trunk/test/CodeGen/WebAssembly/global.ll
Modified: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyAsmBackend.cpp?rev=257655&r1=257654&r2=257655&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyAsmBackend.cpp Wed Jan 13 13:29:37 2016
@@ -73,8 +73,8 @@ void WebAssemblyAsmBackend::applyFixup(c
unsigned DataSize, uint64_t Value,
bool IsPCRel) const {
const MCFixupKindInfo &Info = getFixupKindInfo(Fixup.getKind());
- unsigned NumBytes = RoundUpToAlignment(Info.TargetSize, 8);
- if (!Value)
+ unsigned NumBytes = (Info.TargetSize + 7) / 8;
+ if (Value == 0)
return; // Doesn't change encoding.
// Shift the value into position.
Modified: llvm/trunk/test/CodeGen/WebAssembly/global.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/global.ll?rev=257655&r1=257654&r2=257655&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/global.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/global.ll Wed Jan 13 13:29:37 2016
@@ -175,3 +175,17 @@ define i8* @call_memcpy(i8* %p, i8* noca
; CHECK: .skip 512{{$}}
; CHECK: .size rom, 512{{$}}
@rom = constant [128 x i32] zeroinitializer, align 16
+
+; CHECK: .type array, at object
+; CHECK-NEXT: array:
+; CHECK-NEXT: .skip 8
+; CHECK-NEXT: .size array, 8
+; CHECK: .type pointer_to_array, at object
+; CHECK-NEXT: .section .data.rel.ro,"aw", at progbits
+; CHECK-NEXT: .globl pointer_to_array
+; CHECK-NEXT: .align 2
+; CHECK-NEXT: pointer_to_array:
+; CHECK-NEXT: .int32 array+4
+; CHECK-NEXT: .size pointer_to_array, 4
+ at array = internal constant [8 x i8] zeroinitializer, align 1
+ at pointer_to_array = constant i8* getelementptr inbounds ([8 x i8], [8 x i8]* @array, i32 0, i32 4), align 4
More information about the llvm-commits
mailing list