[llvm-branch-commits] [llvm] 507b7fe - Revert "[ConstantFolding] Fix type mismatch in ConstantFolding for vector typ…"
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Feb 18 10:50:02 PST 2026
Author: Marcos Maronas
Date: 2026-02-18T18:49:58Z
New Revision: 507b7febe79035c7f19a70dadb6c4404ab91e512
URL: https://github.com/llvm/llvm-project/commit/507b7febe79035c7f19a70dadb6c4404ab91e512
DIFF: https://github.com/llvm/llvm-project/commit/507b7febe79035c7f19a70dadb6c4404ab91e512.diff
LOG: Revert "[ConstantFolding] Fix type mismatch in ConstantFolding for vector typ…"
This reverts commit ee3068bd18b23ceb30c0464395fa182cfa28a5fb.
Added:
Modified:
llvm/lib/Analysis/ConstantFolding.cpp
Removed:
llvm/test/Transforms/InstSimplify/ConstProp/vector-type-constant-folding.ll
################################################################################
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 738d0c063a5e4..b0ac14ba8b393 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -329,7 +329,8 @@ bool llvm::IsConstantOffsetFromGlobal(Constant *C, GlobalValue *&GV,
// Look through ptr->int and ptr->ptr casts.
if (CE->getOpcode() == Instruction::PtrToInt ||
- CE->getOpcode() == Instruction::PtrToAddr)
+ CE->getOpcode() == Instruction::PtrToAddr ||
+ CE->getOpcode() == Instruction::BitCast)
return IsConstantOffsetFromGlobal(CE->getOperand(0), GV, Offset, DL,
DSOEquiv);
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/vector-type-constant-folding.ll b/llvm/test/Transforms/InstSimplify/ConstProp/vector-type-constant-folding.ll
deleted file mode 100644
index 5b12fd3ec545f..0000000000000
--- a/llvm/test/Transforms/InstSimplify/ConstProp/vector-type-constant-folding.ll
+++ /dev/null
@@ -1,25 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
-; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
-;
-; Test type mismatch in ConstantFolding for vector types.
-
-define internal void @f() {
-; CHECK-LABEL: define internal void @f() {
-; CHECK-NEXT: ret void
-;
- ret void
-}
-
-define void @test() {
-; CHECK-LABEL: define void @test() {
-; CHECK-NEXT: store <4 x i16> <i16 sub (i16 extractelement (<4 x i16> bitcast (i64 ptrtoint (ptr @f to i64) to <4 x i16>), i32 0), i16 extractelement (<4 x i16> bitcast (i64 ptrtoint (ptr @f to i64) to <4 x i16>), i32 0)), i16 sub (i16 extractelement (<4 x i16> bitcast (i64 ptrtoint (ptr @f to i64) to <4 x i16>), i32 1), i16 extractelement (<4 x i16> bitcast (i64 ptrtoint (ptr @f to i64) to <4 x i16>), i32 1)), i16 sub (i16 extractelement (<4 x i16> bitcast (i64 ptrtoint (ptr @f to i64) to <4 x i16>), i32 2), i16 extractelement (<4 x i16> bitcast (i64 ptrtoint (ptr @f to i64) to <4 x i16>), i32 2)), i16 sub (i16 extractelement (<4 x i16> bitcast (i64 ptrtoint (ptr @f to i64) to <4 x i16>), i32 3), i16 extractelement (<4 x i16> bitcast (i64 ptrtoint (ptr @f to i64) to <4 x i16>), i32 3))>, ptr @f, align 8
-; CHECK-NEXT: ret void
-;
- %1 = ptrtoint ptr @f to i64
- %2 = bitcast i64 %1 to <4 x i16>
- %3 = ptrtoint ptr @f to i64
- %4 = bitcast i64 %3 to <4 x i16>
- %sub = sub <4 x i16> %2, %4
- store <4 x i16> %sub, ptr @f, align 8
- ret void
-}
More information about the llvm-branch-commits
mailing list