This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Remove deprecated MemSDNode->getAlignment()
ClosedPublic

Authored by arichardson on Nov 21 2022, 5:03 AM.

Details

Summary

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().

Diff Detail

Event Timeline

arichardson created this revision.Nov 21 2022, 5:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2022, 5:03 AM
arichardson requested review of this revision.Nov 21 2022, 5:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2022, 5:03 AM
gchatelet accepted this revision.Nov 21 2022, 6:01 AM

Thx a lot for this patch. It was on my plate for a very long time but I haven't had time to do it.
Please fix the M68k issue before submitting.

llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
1006

You may want to keep it for documentation purposes but this is always true by definition. The Align type guarantees to be >=1.

llvm/lib/Target/M68k/M68kInstrInfo.td
525

This should be LD->getAlign(). Same below.
M68k is not part of LLVM_TARGETS_TO_BUILD, it's actually part of LLVM_EXPERIMENTAL_TARGETS_TO_BUILD so I guess it went undetected.

I ran the test on my side with the patch applied. Using LD instead of Ld fixes the build for M68k.

This revision is now accepted and ready to land.Nov 21 2022, 6:01 AM

Fix build for experimental targets