[PATCH] D125114: [SimplifyLibCalls] handle subobjects of constant aggregates

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 02:07:22 PDT 2022


nikic added a comment.

Can you please upload the patch with full context (`-U99999`) again? Hard to check the tests otherwise, as the global declarations are missing. The patch generally looks good to me though.



================
Comment at: llvm/include/llvm/Analysis/ConstantFolding.h:179
+
+Constant* ReadByteArrayFromGlobal(const GlobalVariable *GV, uint64_t Offset);
 }
----------------
nit: `Constant *`


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4242
+      ;
+    else {
       Slice.Array = nullptr;
----------------
I don't really get the purpose of this special case. InstCombine tests pass for me if I drop the `if()` part and always go into the `else` branch.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:1203
+  if (!getConstantStringInfo(LHS, LHSStr, 0, /*TrimAtNul=*/false) ||
+      !getConstantStringInfo(RHS, RHSStr, 0, /*TrimAtNul=*/false))
+    return nullptr;
----------------
This change is kind of unrelated, but it will go away with your other patch anyway.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:1297
+			       /*TrimAtNul=*/false) ||
+	// TODO: Handle zeroinitializer.
+	!StopChar)
----------------
nikic wrote:
> Broken indentation here as well.
Still broken :)


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

https://reviews.llvm.org/D125114



More information about the llvm-commits mailing list