[cfi] Fix LowerBitSets on 32-bit targets.

This code attempts to truncate IntPtrTy to i32, which may be the same
type.

llvm-svn: 256205
This commit is contained in:
Evgeniy Stepanov 2015-12-21 22:14:04 +00:00
parent 2b9349db38
commit fda72c52a2
2 changed files with 22 additions and 1 deletions

View File

@ -683,7 +683,7 @@ Constant *LowerBitSets::createJumpTableEntry(GlobalObject *Src, Function *Dest,
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);

View File

@ -0,0 +1,21 @@
; 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 = !{}