[PATCH] D138246: [AsmPrinter] Fix Crash when Emitting Global Constant of small bit width when targeting Big Endian arch
Henry Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 27 14:04:18 PST 2022
HazyFish updated this revision to Diff 485418.
HazyFish edited the summary of this revision.
HazyFish added a comment.
Address feedback
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138246/new/
https://reviews.llvm.org/D138246
Files:
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/test/CodeGen/AArch64/aarch64_be-global-const.ll
Index: llvm/test/CodeGen/AArch64/aarch64_be-global-const.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/aarch64_be-global-const.ll
@@ -0,0 +1,6 @@
+; RUN: llc -mtriple=aarch64_be < %s | FileCheck %s
+
+; CHECK-LABEL: G:
+; CHECK: .byte 11
+; CHECK: .size G, 1
+ at G = global <4 x i1> <i1 true, i1 false, i1 true, i1 true>
Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -3285,7 +3285,8 @@
ExtraBitsSize = alignTo(ExtraBitsSize, 8);
ExtraBits = Realigned.getRawData()[0] &
(((uint64_t)-1) >> (64 - ExtraBitsSize));
- Realigned.lshrInPlace(ExtraBitsSize);
+ if (BitWidth >= 64)
+ Realigned.lshrInPlace(ExtraBitsSize);
} else
ExtraBits = Realigned.getRawData()[BitWidth / 64];
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138246.485418.patch
Type: text/x-patch
Size: 964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221227/e6d51381/attachment.bin>
More information about the llvm-commits
mailing list