forked from OSchip/llvm-project
[InstCombine] Use IRBuilder to create bitcast
This makes sure that the constant expression bitcast goes through target-dependent constant folding, and thus avoids an additional iteration of InstCombine.
This commit is contained in:
parent
17be8e4a6f
commit
9b5de84e27
|
@ -2151,7 +2151,7 @@ static Instruction *foldBitCastBitwiseLogic(BitCastInst &BitCast,
|
|||
if (match(BO->getOperand(1), m_Constant(C))) {
|
||||
// bitcast (logic X, C) --> logic (bitcast X, C')
|
||||
Value *CastedOp0 = Builder.CreateBitCast(BO->getOperand(0), DestTy);
|
||||
Value *CastedC = ConstantExpr::getBitCast(C, DestTy);
|
||||
Value *CastedC = Builder.CreateBitCast(C, DestTy);
|
||||
return BinaryOperator::Create(BO->getOpcode(), CastedOp0, CastedC);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt < %s -instcombine -S | FileCheck %s
|
||||
; RUN: opt < %s -instcombine -instcombine-infinite-loop-threshold=2 -S | FileCheck %s
|
||||
|
||||
; icmp u/s (a ^ signmask), (b ^ signmask) --> icmp s/u a, b
|
||||
|
||||
|
|
Loading…
Reference in New Issue