mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 12:19:53 +00:00
[ConstantFolding] Use ConstantExpr::getWithOperands
ConstantExpr::getWithOperands does much of the hard work that ConstantFoldInstOperandsImpl tries to do but more completely. This lets us fold ExtractValue/InsertValue expressions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277100 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e43ff14879
commit
8065d776a0
@ -938,6 +938,9 @@ Constant *ConstantFoldInstOperandsImpl(const Value *InstOrCE, Type *DestTy,
|
||||
Ops[0], Ops.slice(1));
|
||||
}
|
||||
|
||||
if (auto *CE = dyn_cast<ConstantExpr>(InstOrCE))
|
||||
return CE->getWithOperands(Ops);
|
||||
|
||||
switch (Opcode) {
|
||||
default: return nullptr;
|
||||
case Instruction::ICmp:
|
||||
|
@ -1375,7 +1375,7 @@ define i16 @PR24763(i8 %V) {
|
||||
|
||||
define i64 @PR28745() {
|
||||
; CHECK-LABEL: @PR28745(
|
||||
; CHECK-NEXT: ret i64 zext (i32 extractvalue ({ i32 } select (i1 icmp eq (i16 extractelement (<2 x i16> bitcast (<1 x i32> <i32 1> to <2 x i16>), i32 0), i16 0), { i32 } { i32 1 }, { i32 } zeroinitializer), 0) to i64)
|
||||
; CHECK-NEXT: ret i64 1
|
||||
|
||||
%b = zext i32 extractvalue ({ i32 } select (i1 icmp eq (i16 extractelement (<2 x i16> bitcast (<1 x i32> <i32 1> to <2 x i16>), i32 0), i16 0), { i32 } { i32 1 }, { i32 } zeroinitializer), 0) to i64
|
||||
ret i64 %b
|
||||
|
@ -10,4 +10,4 @@ entry:
|
||||
}
|
||||
|
||||
; CHECK-LABEL: @test1(
|
||||
; CHECK: ret <2 x i16> <i16 extractvalue (%S select (i1 icmp eq (i16 extractelement (<2 x i16> bitcast (<1 x i32> <i32 1> to <2 x i16>), i32 0), i16 0), %S zeroinitializer, %S { i16 0, i32 1 }), 0), i16 0>
|
||||
; CHECK: ret <2 x i16> zeroinitializer
|
||||
|
Loading…
Reference in New Issue
Block a user