Skip to content

Commit dfb56bf

Browse files
committed
fixup! clang-format
1 parent d620e33 commit dfb56bf

File tree

2 files changed

+12
-15
lines changed
  • llvm
    • include/llvm/Transforms/Scalar
    • lib/Transforms/Scalar

2 files changed

+12
-15
lines changed

llvm/include/llvm/Transforms/Scalar/GVN.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,9 @@ class GVNPass : public PassInfoMixin<GVNPass> {
409409
void assignBlockRPONumber(Function &F);
410410

411411
bool recognizeMinFindingSelectPattern(SelectInst *Select);
412-
bool transformMinFindingSelectPattern(Loop *L, Type *LoadType, BasicBlock *Preheader,
413-
BasicBlock *BB, Value *LHS, Value *RHS,
412+
bool transformMinFindingSelectPattern(Loop *L, Type *LoadType,
413+
BasicBlock *Preheader, BasicBlock *BB,
414+
Value *LHS, Value *RHS,
414415
CmpInst *Comparison, SelectInst *Select,
415416
Value *BasePtr, Value *IndexVal,
416417
Value *OffsetVal);

llvm/lib/Transforms/Scalar/GVN.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3334,12 +3334,10 @@ void GVNPass::assignValNumForDeadCode() {
33343334
}
33353335
}
33363336

3337-
bool GVNPass::transformMinFindingSelectPattern(Loop *L, Type *LoadType, BasicBlock *Preheader,
3338-
BasicBlock *BB, Value *LHS,
3339-
Value *RHS, CmpInst *Comparison,
3340-
SelectInst *Select,
3341-
Value *BasePtr, Value *IndexVal,
3342-
Value *OffsetVal) {
3337+
bool GVNPass::transformMinFindingSelectPattern(
3338+
Loop *L, Type *LoadType, BasicBlock *Preheader, BasicBlock *BB, Value *LHS,
3339+
Value *RHS, CmpInst *Comparison, SelectInst *Select, Value *BasePtr,
3340+
Value *IndexVal, Value *OffsetVal) {
33433341
// Hoist the chain of operations for the second load to preheader.
33443342
// %min.idx.ext = sext i32 %min.idx to i64
33453343
// %ptr.float.min = getelementptr float, ptr %0, i64 %min.idx.ext
@@ -3357,25 +3355,23 @@ bool GVNPass::transformMinFindingSelectPattern(Loop *L, Type *LoadType, BasicBlo
33573355

33583356
// Insert PHI node at the top of this block.
33593357
// This PHI node will be used to memoize the current minimum value so far.
3360-
PHINode *KnownMinPhi =
3361-
PHINode::Create(LoadType, 2, "known_min", BB->begin());
3358+
PHINode *KnownMinPhi = PHINode::Create(LoadType, 2, "known_min", BB->begin());
33623359

33633360
// Hoist the load and build the necessary operations.
33643361
// 1. hoist_0 = sext i32 to i64
33653362
Value *HoistedSExt =
33663363
Builder.CreateSExt(InitialMinIndex, Builder.getInt64Ty(), "hoist_sext");
33673364

33683365
// 2. hoist_gep1 = getelementptr float, ptr BasePtr, i64 HoistedSExt
3369-
Value *HoistedGEP1 = Builder.CreateGEP(LoadType, BasePtr,
3370-
HoistedSExt, "hoist_gep1");
3366+
Value *HoistedGEP1 =
3367+
Builder.CreateGEP(LoadType, BasePtr, HoistedSExt, "hoist_gep1");
33713368

33723369
// 3. hoist_gep2 = getelementptr i8, ptr HoistedGEP1, i64 OffsetVal
33733370
Value *HoistedGEP2 = Builder.CreateGEP(Builder.getInt8Ty(), HoistedGEP1,
33743371
OffsetVal, "hoist_gep2");
33753372

33763373
// 4. hoisted_load = load float, ptr HoistedGEP2
3377-
LoadInst *NewLoad =
3378-
Builder.CreateLoad(LoadType, HoistedGEP2, "hoisted_load");
3374+
LoadInst *NewLoad = Builder.CreateLoad(LoadType, HoistedGEP2, "hoisted_load");
33793375

33803376
// Let the new load now take the place of the old load.
33813377
RHS->replaceAllUsesWith(NewLoad);
@@ -3455,7 +3451,7 @@ bool GVNPass::recognizeMinFindingSelectPattern(SelectInst *Select) {
34553451
// Get type of load.
34563452
Type *LoadType = dyn_cast<LoadInst>(LHS)->getType();
34573453
LLVM_DEBUG(dbgs() << "GVN: Transforming minimum finding pattern.\n");
3458-
return transformMinFindingSelectPattern(L, LoadType,Preheader, BB, LHS, RHS,
3454+
return transformMinFindingSelectPattern(L, LoadType, Preheader, BB, LHS, RHS,
34593455
Comparison, Select, BasePtr, IndexVal,
34603456
OffsetVal);
34613457
}

0 commit comments

Comments
 (0)