Skip to content

Commit 9ad122f

Browse files
committed
Apply clang-format
Signed-off-by: John Lu <[email protected]>
1 parent 736c1e1 commit 9ad122f

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,24 +1033,25 @@ static bool setShiftFlags(BinaryOperator &I, const SimplifyQuery &Q) {
10331033
}
10341034

10351035
static Instruction *transformClampedShift64(BinaryOperator &I,
1036-
const SimplifyQuery &Q,
1037-
InstCombiner::BuilderTy &Builder) {
1036+
const SimplifyQuery &Q,
1037+
InstCombiner::BuilderTy &Builder) {
10381038
Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
10391039
Type *I32Type = Type::getInt32Ty(I.getContext());
10401040
Type *I64Type = Type::getInt64Ty(I.getContext());
10411041

10421042
if (I.getType() == I64Type) {
10431043
KnownBits KnownAmt = computeKnownBits(Op1, /* Depth */ 0, Q);
10441044
if (KnownAmt.getMinValue().uge(32)) {
1045-
Value *TruncVal = Builder.CreateTrunc(Op0, I32Type);
1046-
Value *TruncShiftAmt = Builder.CreateTrunc(Op1, I32Type);
1047-
Value *AdjustedShiftAmt = Builder.CreateSub (TruncShiftAmt,
1048-
ConstantInt::get(I32Type, 32));
1049-
Value *Shl32 = Builder.CreateShl(TruncVal, AdjustedShiftAmt);
1050-
Value *VResult = Builder.CreateVectorSplat(2, ConstantInt::get(I32Type, 0));
1045+
Value *TruncVal = Builder.CreateTrunc(Op0, I32Type);
1046+
Value *TruncShiftAmt = Builder.CreateTrunc(Op1, I32Type);
1047+
Value *AdjustedShiftAmt =
1048+
Builder.CreateSub(TruncShiftAmt, ConstantInt::get(I32Type, 32));
1049+
Value *Shl32 = Builder.CreateShl(TruncVal, AdjustedShiftAmt);
1050+
Value *VResult =
1051+
Builder.CreateVectorSplat(2, ConstantInt::get(I32Type, 0));
10511052

10521053
VResult = Builder.CreateInsertElement(VResult, Shl32,
1053-
ConstantInt::get(I32Type, 1));
1054+
ConstantInt::get(I32Type, 1));
10541055
return CastInst::Create(Instruction::BitCast, VResult, I64Type);
10551056
}
10561057
}

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,12 @@ bool InstCombiner::isValidAddrSpaceCast(unsigned FromAS, unsigned ToAS) const {
195195
}
196196

197197
bool InstCombiner::shouldReduceShl64ToShl32() {
198-
InstructionCost costShl32 = TTIForTargetIntrinsicsOnly.getArithmeticInstrCost(Instruction::Shl, Builder.getInt32Ty(), TTI::TCK_Latency);
199-
InstructionCost costShl64 = TTIForTargetIntrinsicsOnly.getArithmeticInstrCost(Instruction::Shl, Builder.getInt64Ty(), TTI::TCK_Latency);
198+
InstructionCost costShl32 = TTIForTargetIntrinsicsOnly.getArithmeticInstrCost(
199+
Instruction::Shl, Builder.getInt32Ty(), TTI::TCK_Latency);
200+
InstructionCost costShl64 = TTIForTargetIntrinsicsOnly.getArithmeticInstrCost(
201+
Instruction::Shl, Builder.getInt64Ty(), TTI::TCK_Latency);
200202

201-
return costShl32<costShl64;
203+
return costShl32 < costShl64;
202204
}
203205

204206
Value *InstCombinerImpl::EmitGEPOffset(GEPOperator *GEP, bool RewriteGEP) {

0 commit comments

Comments
 (0)