mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
302b728560
Summary: Avoid blind cast from Operator to ExtractElementInst in computeKnownBitsFromOperator. This resulted in some crashes in downstream fuzzy testing. Instead we use getOperand directly on the Operator when accessing the vector/index operands. Haven't seen any problems with InsertElement and ShuffleVector, but I believe those could be used in constant expressions as well. So the same kind of fix as for ExtractElement was also applied for InsertElement. When it comes to ShuffleVector we now simply bail out if a dynamic cast of the Operator to ShuffleVectorInst fails. I've got no reproducer indicating problems for ShuffleVector, and a fix would be slightly more complicated as getShuffleDemandedElts is involved. Reviewers: RKSimon, nikic, spatel, efriedma Reviewed By: RKSimon Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D76564
16 lines
889 B
LLVM
16 lines
889 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -instsimplify -S | FileCheck %s
|
|
|
|
; Reproducer for a crash in computeKnownBitsFromOperator due to blindly
|
|
; casting from llvm::Operator to ExtractElementInst. That does not work
|
|
; if the Operator is a ConstantExpr.
|
|
@g = global [21 x i32] zeroinitializer
|
|
define i32 @test1(i32 %a) {
|
|
; CHECK-LABEL: @test1(
|
|
; CHECK-NEXT: [[T:%.*]] = sub i32 [[A:%.*]], extractelement (<4 x i32> ptrtoint (<4 x i32*> getelementptr inbounds ([21 x i32], [21 x i32]* @g, <4 x i32> zeroinitializer, <4 x i32> <i32 1, i32 2, i32 3, i32 17>) to <4 x i32>), i32 3)
|
|
; CHECK-NEXT: ret i32 [[T]]
|
|
;
|
|
%t = sub i32 %a, extractelement (<4 x i32> ptrtoint (<4 x i32 *> getelementptr inbounds ([21 x i32], [21 x i32] * @g, <4 x i32> zeroinitializer, <4 x i32> <i32 1, i32 2, i32 3, i32 17>) to <4 x i32>), i32 3)
|
|
ret i32 %t
|
|
}
|