This code attempts to truncate IntPtrTy to i32, which may be the same
type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256205
91177308-0d34-0410-b5e6-
96231b3b80d8
ConstantInt *DispOffset =
ConstantInt::get(IntPtrTy, Distance * kX86JumpTableEntrySize + 5);
Constant *OffsetedDisp = ConstantExpr::getSub(Disp, DispOffset);
- OffsetedDisp = ConstantExpr::getTrunc(OffsetedDisp, Int32Ty);
+ OffsetedDisp = ConstantExpr::getTruncOrBitCast(OffsetedDisp, Int32Ty);
ConstantInt *Int3 = ConstantInt::get(Int8Ty, kInt3Code);
--- /dev/null
+; PR25902: gold plugin crash.
+; RUN: opt -mtriple=i686-pc -S -lowerbitsets < %s
+
+define void @f(void ()* %p) {
+entry:
+ %a = bitcast void ()* %p to i8*, !nosanitize !1
+ %b = call i1 @llvm.bitset.test(i8* %a, metadata !"_ZTSFvvE"), !nosanitize !1
+ ret void
+}
+
+define void @g() {
+entry:
+ ret void
+}
+
+declare i1 @llvm.bitset.test(i8*, metadata)
+
+!llvm.bitsets = !{!0}
+
+!0 = !{!"_ZTSFvvE", void ()* @g, i64 0}
+!1 = !{}