• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instsimplify -S | FileCheck %s
3
4; Reproducer for a crash in computeKnownBitsFromOperator due to blindly
5; casting from llvm::Operator to ExtractElementInst. That does not work
6; if the Operator is a ConstantExpr.
7@g = global [21 x i32] zeroinitializer
8define i32 @test1(i32 %a) {
9; CHECK-LABEL: @test1(
10; 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)
11; CHECK-NEXT:    ret i32 [[T]]
12;
13  %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)
14  ret i32 %t
15}
16