[llvm] r256205 - [cfi] Fix LowerBitSets on 32-bit targets.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 14:14:05 PST 2015


Author: eugenis
Date: Mon Dec 21 16:14:04 2015
New Revision: 256205

URL: http://llvm.org/viewvc/llvm-project?rev=256205&view=rev
Log:
[cfi] Fix LowerBitSets on 32-bit targets.

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

Added:
    llvm/trunk/test/Transforms/LowerBitSets/pr25902.ll
Modified:
    llvm/trunk/lib/Transforms/IPO/LowerBitSets.cpp

Modified: llvm/trunk/lib/Transforms/IPO/LowerBitSets.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LowerBitSets.cpp?rev=256205&r1=256204&r2=256205&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/LowerBitSets.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/LowerBitSets.cpp Mon Dec 21 16:14:04 2015
@@ -683,7 +683,7 @@ Constant *LowerBitSets::createJumpTableE
   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);
 

Added: llvm/trunk/test/Transforms/LowerBitSets/pr25902.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LowerBitSets/pr25902.ll?rev=256205&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LowerBitSets/pr25902.ll (added)
+++ llvm/trunk/test/Transforms/LowerBitSets/pr25902.ll Mon Dec 21 16:14:04 2015
@@ -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 = !{}




More information about the llvm-commits mailing list