aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorPiJoules <6019989+PiJoules@users.noreply.github.com>2025-06-04 10:57:59 -0700
committerGitHub <noreply@github.com>2025-06-04 10:57:59 -0700
commitf32f048719455b4813ff7115e4f3a6cdc65efff0 (patch)
treeedc5e366fe700651d99bdce260c3e0b4690e3107 /llvm/lib
parentdb5471945b7e36f55c66dfa74e218390c0329dd4 (diff)
downloadllvm-f32f048719455b4813ff7115e4f3a6cdc65efff0.zip
llvm-f32f048719455b4813ff7115e4f3a6cdc65efff0.tar.gz
llvm-f32f048719455b4813ff7115e4f3a6cdc65efff0.tar.bz2
[llvm] Use ABI instead of preferred alignment for const prop checks (#142500)
We'd hit an assertion checking proper alignment for an i8 when building chromium because we used the prefered alignment (which is 4 bytes) instead of the ABI alignment (which is 1 byte). The ABI alignment should be used because that's the actual alignment needed to load a constant from the vtable. This also updates the two `virtual-const-prop-small-alignment-*` to explicitly give ABI alignments for i64s.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
index 3a25255..a7d9f3b 100644
--- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
+++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
@@ -1845,7 +1845,7 @@ bool DevirtModule::tryVirtualConstProp(
if (BitWidth > 64)
return false;
- Align TypeAlignment = M.getDataLayout().getPrefTypeAlign(RetType);
+ Align TypeAlignment = M.getDataLayout().getABIIntegerTypeAlignment(BitWidth);
// Make sure that each function is defined, does not access memory, takes at
// least one argument, does not use its first argument (which we assume is