llvm.org GIT mirror llvm / f5af6ba
Handle IntToPtr in isBytewiseValue Summary: This helps with more efficient use of memset for pattern initialization From @pcc prototype for -ftrivial-auto-var-init=pattern optimizations Binary size change on CTMark, (with -fuse-ld=lld -Wl,--icf=all, similar results with default linker options) ``` master patch diff Os 8.238864e+05 8.238864e+05 0.0 O3 1.054797e+06 1.054797e+06 0.0 Os zero 8.292384e+05 8.292384e+05 0.0 O3 zero 1.062626e+06 1.062626e+06 0.0 Os pattern 8.579712e+05 8.338048e+05 -0.030299 O3 pattern 1.090502e+06 1.067574e+06 -0.020481 ``` Zero vs Pattern on master ``` zero pattern diff Os 8.292384e+05 8.579712e+05 0.036578 O3 1.062626e+06 1.090502e+06 0.025124 ``` Zero vs Pattern with the patch ``` zero pattern diff Os 8.292384e+05 8.338048e+05 0.003333 O3 1.062626e+06 1.067574e+06 0.003193 ``` Reviewers: pcc, eugenis Subscribers: hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D63967 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365858 91177308-0d34-0410-b5e6-96231b3b80d8 Vitaly Buka a month ago
2 changed file(s) with 14 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
32173217 }
32183218 }
32193219
3220 if (auto *CE = dyn_cast(C)) {
3221 if (CE->getOpcode() == Instruction::IntToPtr) {
3222 auto PS = DL.getPointerSizeInBits(
3223 cast(CE->getType())->getAddressSpace());
3224 return isBytewiseValue(
3225 ConstantExpr::getIntegerCast(CE->getOperand(0),
3226 Type::getIntNTy(Ctx, PS), false),
3227 DL);
3228 }
3229 }
3230
32203231 auto Merge = [&](Value *LHS, Value *RHS) -> Value * {
32213232 if (LHS == RHS)
32223233 return LHS;
793793 "i16* inttoptr (i64 0 to i16*)",
794794 },
795795 {
796 "",
796 "i8 -1",
797797 "i16* inttoptr (i64 -1 to i16*)",
798798 },
799799 {
800 "",
800 "i8 -86",
801801 "i16* inttoptr (i64 -6148914691236517206 to i16*)",
802802 },
803803 {
805805 "i16* inttoptr (i48 -1 to i16*)",
806806 },
807807 {
808 "",
808 "i8 -1",
809809 "i16* inttoptr (i96 -1 to i16*)",
810810 },
811811 {