[PATCH] D72710: [InstCombine] Let combineLoadToNewType preserve ABI alignment of the load (PR44543)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 10:14:10 PST 2020


lebedev.ri added a comment.

LG, thank you.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:466
+  unsigned align = LI.getAlignment();
+  if (!align)
+    align = IC.getDataLayout().getABITypeAlignment(LI.getType());
----------------
lebedev.ri wrote:
> ```
> // If old load did not have an explicit alignment specified,
> // manually preserve the implied (ABI) alignment of the load.
> // Else we may inadvertently incorrectly over-promise alignment.
> ```
Please do mark done comments as done. (the checkbox)


================
Comment at: llvm/test/Transforms/InstCombine/load-bitcast64.ll:60
 ; CHECK-NEXT:    [[TMP0:%.*]] = bitcast i8* [[X:%.*]] to i64*
-; CHECK-NEXT:    [[B1:%.*]] = load i64, i64* [[TMP0]], align 4
+; CHECK-NEXT:    [[B1:%.*]] = load i64, i64* [[TMP0]], align 8
 ; CHECK-NEXT:    ret i64 [[B1]]
----------------
Nice


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72710/new/

https://reviews.llvm.org/D72710





More information about the llvm-commits mailing list