diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2015-12-21 22:14:04 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2015-12-21 22:14:04 +0000 |
commit | ae6314583f5332371831c990ace5bc2e62347d89 (patch) | |
tree | c096581ec27f9d96e4595985c0552d75b853dbab | |
parent | 56afa6e6600151858649d12e4360746918a7978b (diff) |
[cfi] Fix LowerBitSets on 32-bit targets.
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
-rw-r--r-- | lib/Transforms/IPO/LowerBitSets.cpp | 2 | ||||
-rw-r--r-- | test/Transforms/LowerBitSets/pr25902.ll | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/LowerBitSets.cpp b/lib/Transforms/IPO/LowerBitSets.cpp index 65d082b27a8..7b515745c31 100644 --- a/lib/Transforms/IPO/LowerBitSets.cpp +++ b/lib/Transforms/IPO/LowerBitSets.cpp @@ -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); diff --git a/test/Transforms/LowerBitSets/pr25902.ll b/test/Transforms/LowerBitSets/pr25902.ll new file mode 100644 index 00000000000..b9a1203ec0e --- /dev/null +++ b/test/Transforms/LowerBitSets/pr25902.ll @@ -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 = !{} |