[PATCH] D105838: [GlobalOpt] Fix a miscompile when evaluating struct initializers.

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 14 11:12:26 PDT 2021


aeubanks added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/Evaluator.cpp:180
+/// additional pointers to try. Returns the first non-null return value from
+/// Func, or nullptr if the type can't be introspected further.
 static Constant *
----------------
ConstantLoad?


================
Comment at: llvm/lib/Transforms/Utils/Evaluator.cpp:372
 
-          auto castValTy = [&](Constant *P) -> Constant * {
-            Type *Ty = cast<PointerType>(P->getType())->getElementType();
-            if (Constant *FV = ConstantFoldLoadThroughBitcast(Val, Ty, DL)) {
+          auto tryCastValTy = [&](Constant *P) -> Constant * {
+            // The conversion is illegal if the store is wider than the
----------------
Can you make this uppercase?


================
Comment at: llvm/test/Transforms/GlobalOpt/store-struct-element.ll:2
+; RUN: opt < %s -globalopt -S -o - | FileCheck %s
+; REQUIRES: x86-registered-target
+
----------------
is this necessary?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105838



More information about the llvm-commits mailing list