llvm-6502/include/llvm
Argyrios Kyrtzidis acb8d9fbe3 Eliminate redundant bitwise operations when using a llvm/ADT/PointerUnion.
For comparison, with this code sample:

PointerUnion<int *, char *> Data;
PointerUnion<int *, char *> foo1() {
	Data = new int;
	return new int;
}
PointerUnion<int *, char *> foo2() {
	Data = new char;
	return new char;
}

Before this patch we would get:

define i64 @_Z4foo1v() uwtable ssp {
  %1 = tail call noalias i8* @_Znwm(i64 4)
  %2 = ptrtoint i8* %1 to i64
  %3 = load i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8
  %4 = and i64 %3, 1
  %.masked.i = and i64 %2, -3
  %5 = or i64 %4, %.masked.i
  store i64 %5, i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8
  %6 = tail call noalias i8* @_Znwm(i64 4)
  %7 = ptrtoint i8* %6 to i64
  %8 = and i64 %7, -3
  ret i64 %8
}

define i64 @_Z4foo2v() uwtable ssp {
  %1 = tail call noalias i8* @_Znwm(i64 1)
  %2 = ptrtoint i8* %1 to i64
  %3 = load i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8
  %4 = and i64 %3, 1
  %5 = or i64 %2, %4
  %6 = or i64 %5, 2
  store i64 %6, i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8
  %7 = tail call noalias i8* @_Znwm(i64 1)
  %8 = ptrtoint i8* %7 to i64
  %9 = or i64 %8, 2
  ret i64 %9
}

After the patch:

define i64 @_Z4foo1v() uwtable ssp {
  %1 = tail call noalias i8* @_Znwm(i64 4)
  %2 = ptrtoint i8* %1 to i64
  store i64 %2, i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8
  %3 = tail call noalias i8* @_Znwm(i64 4)
  %4 = ptrtoint i8* %3 to i64
  ret i64 %4
}

declare noalias i8* @_Znwm(i64)

define i64 @_Z4foo2v() uwtable ssp {
  %1 = tail call noalias i8* @_Znwm(i64 1)
  %2 = ptrtoint i8* %1 to i64
  %3 = or i64 %2, 2
  store i64 %3, i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8
  %4 = tail call noalias i8* @_Znwm(i64 1)
  %5 = ptrtoint i8* %4 to i64
  %6 = or i64 %5, 2
  ret i64 %6
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169147 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 19:59:23 +00:00
..
ADT Eliminate redundant bitwise operations when using a llvm/ADT/PointerUnion. 2012-12-03 19:59:23 +00:00
Analysis Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Assembly Prune some includes and forward declarations. 2012-03-26 06:58:25 +00:00
Bitcode Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
CodeGen Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Config llvm/Config/config.h.cmake: Good bye, Kevin! We won't honor authors in comments. 2012-10-29 16:07:28 +00:00
DebugInfo Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
ExecutionEngine Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MC Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Object Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Support Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
TableGen Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Target Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Transforms ASan: add blacklist file to ASan pass options. Clang patch for this will follow. 2012-12-03 19:09:26 +00:00
AddressingMode.h Use DataTypes.h 2012-10-08 23:14:28 +00:00
Argument.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Attributes.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
AutoUpgrade.h
BasicBlock.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
CallGraphSCCPass.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
CallingConv.h Add the Erlang/HiPE calling convention, patch by Yiannis Tsiouris. 2012-11-16 12:36:39 +00:00
CMakeLists.txt llvm/include/llvm/CMakeLists.txt: Cut dependency to intrinsics_gen. 2012-07-06 15:55:39 +00:00
Constant.h Make GlobalOpt be conservative with TLS variables (PR14309) 2012-11-15 11:40:00 +00:00
Constants.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
DataLayout.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
DebugInfo.h Add 'getInt64Field()' method to get the signed integer instead of unsigned. 2012-12-03 19:44:25 +00:00
DefaultPasses.h Fix a couple include directives that used angle brackets for llvm files. 2012-09-15 18:41:37 +00:00
DerivedTypes.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
DIBuilder.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Function.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
GlobalAlias.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
GlobalValue.h Remove unnecessary classof()'s 2012-10-11 23:30:49 +00:00
GlobalVariable.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
GVMaterializer.h
InitializePasses.h Initial commit of MemorySanitizer. 2012-11-29 09:57:20 +00:00
InlineAsm.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
InstrTypes.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Instruction.def [unwind removal] Remove all of the code for the dead 'unwind' instruction. There 2012-02-06 21:44:22 +00:00
Instruction.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Instructions.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
InstVisitor.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
IntrinsicInst.h va_start, va_end, va_copy: InstrinsicInst subclasses and InstVisitor support. 2012-10-29 09:39:03 +00:00
Intrinsics.h Attributes Rewrite 2012-10-15 04:46:55 +00:00
Intrinsics.td Add llvm.ceil, llvm.trunc, llvm.rint, llvm.nearbyint intrinsics. 2012-11-15 06:51:10 +00:00
IntrinsicsARM.td ARM: Use a dedicated intrinsic for vector bitwise select. 2012-09-21 00:18:20 +00:00
IntrinsicsHexagon.td Test commit. 2012-08-17 06:36:26 +00:00
IntrinsicsMips.td Support MIPS DSP Rev2 intrinsics. 2012-08-27 12:29:01 +00:00
IntrinsicsNVVM.td Remove the PTX back-end and all of its artifacts (triple, etc.) 2012-05-24 21:38:21 +00:00
IntrinsicsPowerPC.td
IntrinsicsX86.td Add support of RTM from TSX extension 2012-11-08 07:28:54 +00:00
IntrinsicsXCore.td
IRBuilder.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
LinkAllPasses.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
LinkAllVMCore.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Linker.h Prune some includes and forward declarations. 2012-03-26 06:58:25 +00:00
LLVMContext.h Mark unimplemented copy constructors and copy assignment operators as LLVM_DELETED_FUNCTION. 2012-09-17 07:16:40 +00:00
MDBuilder.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Metadata.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Module.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
OperandTraits.h
Operator.h Fast-math comments and convenience method 2012-11-28 21:11:25 +00:00
Pass.h One more step towards making doInitialization and doFinalization useful for 2012-11-29 17:47:05 +00:00
PassAnalysisSupport.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
PassManager.h One more step towards making doInitialization and doFinalization useful for 2012-11-29 17:47:05 +00:00
PassManagers.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
PassRegistry.h
PassSupport.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
SymbolTableListTraits.h Remove unused typedefs gcc4.8 warns about. 2012-09-05 17:55:46 +00:00
TargetTransformInfo.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Type.h Teach Type::getPointerAddressSpace to look through pointer vectors 2012-11-01 09:37:49 +00:00
TypeBuilder.h Move llvm/Support/TypeBuilder.h -> llvm/TypeBuilder.h. This completes 2012-07-15 23:45:24 +00:00
TypeFinder.h Move the "findUsedStructTypes" functionality outside of the Module class. 2012-08-03 00:30:35 +00:00
Use.h Add includes of Compiler.h to fix build bot failures. 2012-09-16 21:50:09 +00:00
User.h Remove unnecessary classof()'s 2012-10-11 23:30:49 +00:00
Value.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
ValueSymbolTable.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00