llvm-project/llvm/test/CodeGen/Mips/load-max-alignment.ll
Alex Richardson 88218d5c52 [SelectionDAG] Remove deprecated MemSDNode->getAlignment()
I noticed a an assertion error when building MIPS code that loaded from
NULL. Loading from NULL ends up being a load with maximum alignment, and
due to integer truncation the value maximum was interpreted as 0 and the
assertion in MipsDAGToDAGISel::Select() failed. This previously happened
to work, but the maximum alignment was increased in
df84c1fe78130a86445d57563dea742e1b85156a, so it no longer fits into a 32
bit integer.
Instead of just fixing the one MIPS case, this patch removes all uses of
the deprecated getAlignment() call and replaces them with getAlign().

Differential Revision: https://reviews.llvm.org/D138420
2022-11-23 09:04:42 +00:00

17 lines
647 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
;; Loading a value with max aligment triggered an assertion due to unsigned
;; integer truncation causing 1<<32 to be interpreted as 0 after the max
;; alignment was increased in df84c1fe78130a86445d57563dea742e1b85156a
; RUN: llc -mtriple=mips64 -target-abi=n64 -relocation-model=pic < %s | FileCheck %s
define i32 @load_max_align(ptr %arg) nounwind {
; CHECK-LABEL: load_max_align:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: lw $2, 0($4)
; CHECK-NEXT: jr $ra
; CHECK-NEXT: nop
entry:
%result = load i32, ptr %arg, align 4294967296
ret i32 %result
}