[clang] [llvm] [IR] Require DataLayout for pointer cast elimination (PR #162279)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 7 06:05:22 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,c,cpp -- clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c clang/test/CodeGenCXX/builtin-invoke.cpp llvm/include/llvm/IR/InstrTypes.h llvm/lib/Analysis/ConstantFolding.cpp llvm/lib/Analysis/InstructionSimplify.cpp llvm/lib/IR/ConstantFold.cpp llvm/lib/IR/Instructions.cpp llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp llvm/unittests/IR/InstructionsTest.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index c2b3f3cb6..b744537ae 100755
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -1487,8 +1487,8 @@ Constant *llvm::ConstantFoldCastOperand(unsigned Opcode, Constant *C,
     if (CE->isCast())
       if (unsigned NewOp = CastInst::isEliminableCastPair(
               Instruction::CastOps(CE->getOpcode()),
-              Instruction::CastOps(Opcode),
-              CE->getOperand(0)->getType(), C->getType(), DestTy, &DL))
+              Instruction::CastOps(Opcode), CE->getOperand(0)->getType(),
+              C->getType(), DestTy, &DL))
         return ConstantFoldCastOperand(NewOp, CE->getOperand(0), DestTy, DL);
 
   switch (Opcode) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/162279


More information about the llvm-commits mailing list