[PATCH] D138246: [AsmPrinter] Fix Crash when Emitting Global Constant of small bit width when targeting Big Endian arch
Peter Rong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 29 00:08:33 PDT 2023
Peter updated this revision to Diff 509226.
Peter added a comment.
`arc land`
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
@@ -3369,7 +3369,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.509226.patch
Type: text/x-patch
Size: 964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230329/f0ccb6ef/attachment.bin>
More information about the llvm-commits
mailing list