[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-25 Thread Stephen Tozer via cfe-commits

SLTozer wrote:

> My guess here would have been that the issue is the cases where an 
> Instruction* or BasicBlock* is passed rather than BB+Iterator, because those 
> two cases go through an out-of-line constructor.

Seems like you're right - removing the extra dereference does 
little-to-nothing, but allowing the constructors to be inlined mitigates most 
of the cost. It still ends up being [a net negative for 
performance](http://llvm-compile-time-tracker.com/compare.php?from=d75f9dd1d29b332bdc51346de63cbc04646354d7=3acef100b23fb6fa616523dd0d1b85945adb7900=instructions%3Au)
 though, even after allowing the constructors to become inlined.

https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Nikita Popov via cfe-commits

nikic wrote:

> > Looks like using InsertPosition in IRBuilder has some overhead:
> 
> Hm, we're adding an extra pointer chase when we give up passing a basicblock 
> - I think then it makes sense to keep the option to pass BB+It, and do so 
> when the caller already knows the BB (while removing the need to pass the BB 
> around for functions that only have an instruction).

My guess here would have been that the issue is the cases where an Instruction* 
or BasicBlock* is passed rather than BB+Iterator, because those two cases go 
through an out-of-line constructor.

https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Stephen Tozer via cfe-commits

SLTozer wrote:

> Looks like using InsertPosition in IRBuilder has some overhead: 

Hm, we're adding an extra pointer chase when we give up passing a basicblock - 
I think then it makes sense to keep the option to pass BB+It, and do so when 
the caller already knows the BB (while removing the need to pass the BB around 
for functions that only need an insert point).

https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Nikita Popov via cfe-commits

nikic wrote:

Looks like using InsertPosition in IRBuilder has some overhead: 
https://llvm-compile-time-tracker.com/compare.php?from=317277e4f961edf13132914a58a26408db4ab0aa=6481dc57612671ebe77fe9c34214fba94e1b3b27=instructions:u

So it might make sense to keep some explicit overloads for IRBuilder (not sure 
which ones are hot though).

https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `premerge-monolithic-linux` 
running on `premerge-linux-1` while building `clang,llvm,mlir,polly` at step 6 
"build-unified-tree".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/153/builds/979

Here is the relevant piece of the build log for the reference:
```
Step 6 (build-unified-tree) failure: build (failure)
...
349.209 [3512/58/2037] Building CXX object 
tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o
349.616 [3511/58/2038] Building CXX object 
tools/clang/lib/Interpreter/CMakeFiles/obj.clangInterpreter.dir/InterpreterUtils.cpp.o
349.917 [3510/58/2039] Building CXX object 
tools/clang/tools/clang-import-test/CMakeFiles/clang-import-test.dir/clang-import-test.cpp.o
349.986 [3509/58/2040] Building CXX object 
tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/Targets/XCore.cpp.o
351.696 [3508/58/2041] Building CXX object 
tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGDebugInfo.cpp.o
351.733 [3507/58/2042] Building CXX object 
tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/Targets/X86.cpp.o
353.616 [3506/58/2043] Building CXX object 
tools/clang/lib/Interpreter/CMakeFiles/obj.clangInterpreter.dir/IncrementalParser.cpp.o
353.744 [3505/58/2044] Building CXX object 
tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGOpenMPRuntime.cpp.o
354.405 [3504/58/2045] Building CXX object 
tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CodeGenPGO.cpp.o
354.757 [3503/58/2046] Building CXX object 
examples/Kaleidoscope/Chapter7/CMakeFiles/Kaleidoscope-Ch7.dir/toy.cpp.o
FAILED: 
examples/Kaleidoscope/Chapter7/CMakeFiles/Kaleidoscope-Ch7.dir/toy.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/clang++ 
-DBUILD_EXAMPLES -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS 
-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS 
-D__STDC_LIMIT_MACROS 
-I/build/buildbot/premerge-monolithic-linux/build/examples/Kaleidoscope/Chapter7
 
-I/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/examples/Kaleidoscope/Chapter7
 -I/build/buildbot/premerge-monolithic-linux/build/include 
-I/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include -gmlt 
-fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time 
-Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
-Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion 
-Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color 
-ffunction-sections -fdata-sections -O3 -DNDEBUG  -fno-exceptions 
-funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT 
examples/Kaleidoscope/Chapter7/CMakeFiles/Kaleidoscope-Ch7.dir/toy.cpp.o -MF 
examples/Kaleidoscope/Chapter7/CMakeFiles/Kaleidoscope-Ch7.dir/toy.cpp.o.d -o 
examples/Kaleidoscope/Chapter7/CMakeFiles/Kaleidoscope-Ch7.dir/toy.cpp.o -c 
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/examples/Kaleidoscope/Chapter7/toy.cpp
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/examples/Kaleidoscope/Chapter7/toy.cpp:747:15:
 error: no matching constructor for initialization of 'IRBuilder<>'
  IRBuilder<> TmpB(>getEntryBlock(),
  ^~~
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/IR/IRBuilder.h:2656:12:
 note: candidate constructor not viable: no known conversion from 'iterator' 
(aka 'ilist_iterator_w_bits, false, false>') to 'MDNode *' for 
2nd argument
  explicit IRBuilder(InsertPosition IP, MDNode *FPMathTag = nullptr,
   ^
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/IR/IRBuilder.h:2663:12:
 note: candidate constructor not viable: no known conversion from 'iterator' 
(aka 'ilist_iterator_w_bits, false, false>') to 
'llvm::ConstantFolder' for 2nd argument
  explicit IRBuilder(InsertPosition IP, FolderTy Folder,
   ^
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/IR/IRBuilder.h:2646:3:
 note: candidate constructor not viable: no known conversion from 'BasicBlock 
*' to 'LLVMContext &' for 1st argument
  IRBuilder(LLVMContext , FolderTy Folder, InserterTy Inserter = InserterTy(),
  ^
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/IR/IRBuilder.h:2652:12:
 note: candidate constructor not viable: no known conversion from 'BasicBlock 
*' to 'LLVMContext &' for 1st argument
  explicit IRBuilder(LLVMContext , MDNode *FPMathTag = nullptr,
   ^
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/IR/IRBuilder.h:2674:3:
 note: candidate constructor not viable: requires 1 argument, but 2 were 
provided
  IRBuilder(const IRBuilder &) = delete;
  ^
1 error generated.
357.285 [3503/57/2047] Building CXX object 

[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Stephen Tozer via cfe-commits

SLTozer wrote:

Looks like I missed a spot - reverting for now, will wait for a bit to see if 
any other errors fall out from the various configurations on CI before 
reapplying.

https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Stephen Tozer via cfe-commits

https://github.com/SLTozer closed 
https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Stephen Tozer via cfe-commits

https://github.com/SLTozer edited 
https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Stephen Tozer via cfe-commits


@@ -44,15 +44,19 @@ template <> struct ilist_alloc_traits {
 iterator_range::iterator>
 getDbgRecordRange(DbgMarker *);
 
+/// Class used to generate an insert position (ultimately always a
+/// BasicBlock::iterator, which it will implicitly convert to) from either:
+/// - An Instruction, inserting immediately prior.

SLTozer wrote:

It isn't deprecated yet, but I can put a comment indicating the future intent.

https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Stephen Tozer via cfe-commits


@@ -637,8 +637,7 @@ void ARMParallelDSP::InsertParallelMACs(Reduction ) {
 Intrinsic::getDeclaration(M, Intrinsic::arm_smlad) :
 Intrinsic::getDeclaration(M, Intrinsic::arm_smlald);
 
-IRBuilder Builder(InsertAfter->getParent(),
-BasicBlock::iterator(InsertAfter));
+IRBuilder Builder((BasicBlock::iterator(InsertAfter)));

SLTozer wrote:

Funnily enough, that doesn't actually work:
```
./llvm/lib/Target/ARM/ARMParallelDSP.cpp:640:32: warning: parentheses were 
disambiguated as a function declaration [-Wvexing-parse]
  640 | IRBuilder Builder(BasicBlock::iterator(InsertAfter));
  |^~~
```
Hence the weird double parentheses - however having looked back at this I can 
see `InsertAfter` is always non-null, so `->getIterator()` is safe.

https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Nikita Popov via cfe-commits


@@ -637,8 +637,7 @@ void ARMParallelDSP::InsertParallelMACs(Reduction ) {
 Intrinsic::getDeclaration(M, Intrinsic::arm_smlad) :
 Intrinsic::getDeclaration(M, Intrinsic::arm_smlald);
 
-IRBuilder Builder(InsertAfter->getParent(),
-BasicBlock::iterator(InsertAfter));
+IRBuilder Builder((BasicBlock::iterator(InsertAfter)));

nikic wrote:

```suggestion
IRBuilder Builder(BasicBlock::iterator(InsertAfter));
```

https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Nikita Popov via cfe-commits

https://github.com/nikic approved this pull request.

LGTM if CI is happy.

https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Nikita Popov via cfe-commits


@@ -3136,7 +3136,7 @@ static void LLVMPositionBuilderImpl(IRBuilder<> *Builder, 
BasicBlock *Block,
 Instruction *Instr, bool BeforeDbgRecords) 
{
   BasicBlock::iterator I = Instr ? Instr->getIterator() : Block->end();
   I.setHeadBit(BeforeDbgRecords);
-  Builder->SetInsertPoint(Block, I);
+  Builder->SetInsertPoint(I);

nikic wrote:

Maybe assert that BB and Instr are consistent here?

https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Nikita Popov via cfe-commits


@@ -44,15 +44,19 @@ template <> struct ilist_alloc_traits {
 iterator_range::iterator>
 getDbgRecordRange(DbgMarker *);
 
+/// Class used to generate an insert position (ultimately always a
+/// BasicBlock::iterator, which it will implicitly convert to) from either:
+/// - An Instruction, inserting immediately prior.

nikic wrote:

Indicate that this is deprecated?

https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Nikita Popov via cfe-commits

https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-mlir

Author: Stephen Tozer (SLTozer)


Changes

Uses the new InsertPosition class (added in #94226) to simplify some of 
the IRBuilder interface, and removes the need to pass a BasicBlock alongside a 
BasicBlock::iterator, using the fact that we can now get the parent basic block 
from the iterator even if it points to the sentinel. This patch removes the 
BasicBlock argument from each constructor or call to setInsertPoint.

This has no functional effect, but later on as we look to remove the 
`Instruction *InsertBefore` argument from instruction-creation (discussed 
[here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)),
 this will simplify the process by allowing us to deprecate the InsertPosition 
constructor directly and catch all the cases where we use instructions rather 
than iterators.

---

Patch is 122.75 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/96497.diff


97 Files Affected:

- (modified) clang/lib/CodeGen/CGBlocks.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGGPUBuiltin.cpp (+2-2) 
- (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGObjC.cpp (+3-4) 
- (modified) clang/lib/CodeGen/CGObjCMac.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGStmt.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenABITypes.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+2-2) 
- (modified) llvm/include/llvm/IR/IRBuilder.h (+15-63) 
- (modified) llvm/include/llvm/IR/Instruction.h (+6-2) 
- (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h 
(+1-3) 
- (modified) llvm/lib/Analysis/MemoryBuiltins.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/AtomicExpandPass.cpp (+4-4) 
- (modified) llvm/lib/CodeGen/CodeGenPrepare.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/ExpandLargeFpConvert.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/ExpandMemCmp.cpp (+3-3) 
- (modified) llvm/lib/CodeGen/ExpandVectorPredication.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/HardwareLoops.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/IntrinsicLowering.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/SafeStack.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/ShadowStackGCLowering.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/SjLjEHPrepare.cpp (+2-3) 
- (modified) llvm/lib/CodeGen/WasmEHPrepare.cpp (+1-1) 
- (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+13-16) 
- (modified) llvm/lib/IR/AutoUpgrade.cpp (+2-2) 
- (modified) llvm/lib/IR/Core.cpp (+1-1) 
- (modified) llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp (+2-2) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp (+1-1) 
- (modified) llvm/lib/Target/ARM/ARMParallelDSP.cpp (+2-4) 
- (modified) llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp (+1-1) 
- (modified) llvm/lib/Target/ARM/MVETailPredication.cpp (+1-1) 
- (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+2-2) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp (+2-4) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp (+1-1) 
- (modified) llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp (+1-1) 
- (modified) llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp (+1-1) 
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp 
(+1-1) 
- (modified) llvm/lib/Target/X86/X86LowerAMXIntrinsics.cpp (+2-2) 
- (modified) llvm/lib/Target/X86/X86LowerAMXType.cpp (+1-2) 
- (modified) llvm/lib/Target/X86/X86WinEHState.cpp (+1-1) 
- (modified) 
llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+5-7) 
- (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+1-1) 
- (modified) llvm/lib/Transforms/IPO/OpenMPOpt.cpp (+1-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (+1-1) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+2-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (+2-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp (+1-1) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp (+2-3) 
- (modified) llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp (+2-2) 
- (modified) llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (+22-22) 
- (modified) llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp (+1-1) 
- (modified) 

[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-backend-aarch64

Author: Stephen Tozer (SLTozer)


Changes

Uses the new InsertPosition class (added in #94226) to simplify some of 
the IRBuilder interface, and removes the need to pass a BasicBlock alongside a 
BasicBlock::iterator, using the fact that we can now get the parent basic block 
from the iterator even if it points to the sentinel. This patch removes the 
BasicBlock argument from each constructor or call to setInsertPoint.

This has no functional effect, but later on as we look to remove the 
`Instruction *InsertBefore` argument from instruction-creation (discussed 
[here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)),
 this will simplify the process by allowing us to deprecate the InsertPosition 
constructor directly and catch all the cases where we use instructions rather 
than iterators.

---

Patch is 122.75 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/96497.diff


97 Files Affected:

- (modified) clang/lib/CodeGen/CGBlocks.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGGPUBuiltin.cpp (+2-2) 
- (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGObjC.cpp (+3-4) 
- (modified) clang/lib/CodeGen/CGObjCMac.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGStmt.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenABITypes.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+2-2) 
- (modified) llvm/include/llvm/IR/IRBuilder.h (+15-63) 
- (modified) llvm/include/llvm/IR/Instruction.h (+6-2) 
- (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h 
(+1-3) 
- (modified) llvm/lib/Analysis/MemoryBuiltins.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/AtomicExpandPass.cpp (+4-4) 
- (modified) llvm/lib/CodeGen/CodeGenPrepare.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/ExpandLargeFpConvert.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/ExpandMemCmp.cpp (+3-3) 
- (modified) llvm/lib/CodeGen/ExpandVectorPredication.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/HardwareLoops.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/IntrinsicLowering.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/SafeStack.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/ShadowStackGCLowering.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/SjLjEHPrepare.cpp (+2-3) 
- (modified) llvm/lib/CodeGen/WasmEHPrepare.cpp (+1-1) 
- (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+13-16) 
- (modified) llvm/lib/IR/AutoUpgrade.cpp (+2-2) 
- (modified) llvm/lib/IR/Core.cpp (+1-1) 
- (modified) llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp (+2-2) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp (+1-1) 
- (modified) llvm/lib/Target/ARM/ARMParallelDSP.cpp (+2-4) 
- (modified) llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp (+1-1) 
- (modified) llvm/lib/Target/ARM/MVETailPredication.cpp (+1-1) 
- (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+2-2) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp (+2-4) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp (+1-1) 
- (modified) llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp (+1-1) 
- (modified) llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp (+1-1) 
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp 
(+1-1) 
- (modified) llvm/lib/Target/X86/X86LowerAMXIntrinsics.cpp (+2-2) 
- (modified) llvm/lib/Target/X86/X86LowerAMXType.cpp (+1-2) 
- (modified) llvm/lib/Target/X86/X86WinEHState.cpp (+1-1) 
- (modified) 
llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+5-7) 
- (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+1-1) 
- (modified) llvm/lib/Transforms/IPO/OpenMPOpt.cpp (+1-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (+1-1) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+2-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (+2-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp (+1-1) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp (+2-3) 
- (modified) llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp (+2-2) 
- (modified) llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (+22-22) 
- (modified) llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp (+1-1) 
- (modified) 

[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-backend-arm

Author: Stephen Tozer (SLTozer)


Changes

Uses the new InsertPosition class (added in #94226) to simplify some of 
the IRBuilder interface, and removes the need to pass a BasicBlock alongside a 
BasicBlock::iterator, using the fact that we can now get the parent basic block 
from the iterator even if it points to the sentinel. This patch removes the 
BasicBlock argument from each constructor or call to setInsertPoint.

This has no functional effect, but later on as we look to remove the 
`Instruction *InsertBefore` argument from instruction-creation (discussed 
[here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)),
 this will simplify the process by allowing us to deprecate the InsertPosition 
constructor directly and catch all the cases where we use instructions rather 
than iterators.

---

Patch is 122.75 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/96497.diff


97 Files Affected:

- (modified) clang/lib/CodeGen/CGBlocks.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGGPUBuiltin.cpp (+2-2) 
- (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGObjC.cpp (+3-4) 
- (modified) clang/lib/CodeGen/CGObjCMac.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGStmt.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenABITypes.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+2-2) 
- (modified) llvm/include/llvm/IR/IRBuilder.h (+15-63) 
- (modified) llvm/include/llvm/IR/Instruction.h (+6-2) 
- (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h 
(+1-3) 
- (modified) llvm/lib/Analysis/MemoryBuiltins.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/AtomicExpandPass.cpp (+4-4) 
- (modified) llvm/lib/CodeGen/CodeGenPrepare.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/ExpandLargeFpConvert.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/ExpandMemCmp.cpp (+3-3) 
- (modified) llvm/lib/CodeGen/ExpandVectorPredication.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/HardwareLoops.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/IntrinsicLowering.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/SafeStack.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/ShadowStackGCLowering.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/SjLjEHPrepare.cpp (+2-3) 
- (modified) llvm/lib/CodeGen/WasmEHPrepare.cpp (+1-1) 
- (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+13-16) 
- (modified) llvm/lib/IR/AutoUpgrade.cpp (+2-2) 
- (modified) llvm/lib/IR/Core.cpp (+1-1) 
- (modified) llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp (+2-2) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp (+1-1) 
- (modified) llvm/lib/Target/ARM/ARMParallelDSP.cpp (+2-4) 
- (modified) llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp (+1-1) 
- (modified) llvm/lib/Target/ARM/MVETailPredication.cpp (+1-1) 
- (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+2-2) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp (+2-4) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp (+1-1) 
- (modified) llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp (+1-1) 
- (modified) llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp (+1-1) 
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp 
(+1-1) 
- (modified) llvm/lib/Target/X86/X86LowerAMXIntrinsics.cpp (+2-2) 
- (modified) llvm/lib/Target/X86/X86LowerAMXType.cpp (+1-2) 
- (modified) llvm/lib/Target/X86/X86WinEHState.cpp (+1-1) 
- (modified) 
llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+5-7) 
- (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+1-1) 
- (modified) llvm/lib/Transforms/IPO/OpenMPOpt.cpp (+1-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (+1-1) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+2-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (+2-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp (+1-1) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp (+2-3) 
- (modified) llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp (+2-2) 
- (modified) llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (+22-22) 
- (modified) llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp (+1-1) 
- (modified) 

[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread via cfe-commits

llvmbot wrote:



@llvm/pr-subscribers-hlsl
@llvm/pr-subscribers-backend-webassembly

@llvm/pr-subscribers-clang-codegen

Author: Stephen Tozer (SLTozer)


Changes

Uses the new InsertPosition class (added in #94226) to simplify some of 
the IRBuilder interface, and removes the need to pass a BasicBlock alongside a 
BasicBlock::iterator, using the fact that we can now get the parent basic block 
from the iterator even if it points to the sentinel. This patch removes the 
BasicBlock argument from each constructor or call to setInsertPoint.

This has no functional effect, but later on as we look to remove the 
`Instruction *InsertBefore` argument from instruction-creation (discussed 
[here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)),
 this will simplify the process by allowing us to deprecate the InsertPosition 
constructor directly and catch all the cases where we use instructions rather 
than iterators.

---

Patch is 122.75 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/96497.diff


97 Files Affected:

- (modified) clang/lib/CodeGen/CGBlocks.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGGPUBuiltin.cpp (+2-2) 
- (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGObjC.cpp (+3-4) 
- (modified) clang/lib/CodeGen/CGObjCMac.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGStmt.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenABITypes.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+2-2) 
- (modified) llvm/include/llvm/IR/IRBuilder.h (+15-63) 
- (modified) llvm/include/llvm/IR/Instruction.h (+6-2) 
- (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h 
(+1-3) 
- (modified) llvm/lib/Analysis/MemoryBuiltins.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/AtomicExpandPass.cpp (+4-4) 
- (modified) llvm/lib/CodeGen/CodeGenPrepare.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/ExpandLargeFpConvert.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/ExpandMemCmp.cpp (+3-3) 
- (modified) llvm/lib/CodeGen/ExpandVectorPredication.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/HardwareLoops.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/IntrinsicLowering.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/SafeStack.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/ShadowStackGCLowering.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/SjLjEHPrepare.cpp (+2-3) 
- (modified) llvm/lib/CodeGen/WasmEHPrepare.cpp (+1-1) 
- (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+13-16) 
- (modified) llvm/lib/IR/AutoUpgrade.cpp (+2-2) 
- (modified) llvm/lib/IR/Core.cpp (+1-1) 
- (modified) llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp (+2-2) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp (+1-1) 
- (modified) llvm/lib/Target/ARM/ARMParallelDSP.cpp (+2-4) 
- (modified) llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp (+1-1) 
- (modified) llvm/lib/Target/ARM/MVETailPredication.cpp (+1-1) 
- (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+2-2) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp (+2-4) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp (+1-1) 
- (modified) llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp (+1-1) 
- (modified) llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp (+1-1) 
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp 
(+1-1) 
- (modified) llvm/lib/Target/X86/X86LowerAMXIntrinsics.cpp (+2-2) 
- (modified) llvm/lib/Target/X86/X86LowerAMXType.cpp (+1-2) 
- (modified) llvm/lib/Target/X86/X86WinEHState.cpp (+1-1) 
- (modified) 
llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+5-7) 
- (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+1-1) 
- (modified) llvm/lib/Transforms/IPO/OpenMPOpt.cpp (+1-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (+1-1) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+2-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (+2-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp (+1-1) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp (+2-3) 
- (modified) llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp (+2-2) 
- (modified) llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (+22-22) 
- (modified) 

[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-backend-amdgpu

Author: Stephen Tozer (SLTozer)


Changes

Uses the new InsertPosition class (added in #94226) to simplify some of 
the IRBuilder interface, and removes the need to pass a BasicBlock alongside a 
BasicBlock::iterator, using the fact that we can now get the parent basic block 
from the iterator even if it points to the sentinel. This patch removes the 
BasicBlock argument from each constructor or call to setInsertPoint.

This has no functional effect, but later on as we look to remove the 
`Instruction *InsertBefore` argument from instruction-creation (discussed 
[here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)),
 this will simplify the process by allowing us to deprecate the InsertPosition 
constructor directly and catch all the cases where we use instructions rather 
than iterators.

---

Patch is 122.75 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/96497.diff


97 Files Affected:

- (modified) clang/lib/CodeGen/CGBlocks.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGGPUBuiltin.cpp (+2-2) 
- (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGObjC.cpp (+3-4) 
- (modified) clang/lib/CodeGen/CGObjCMac.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGStmt.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenABITypes.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+2-2) 
- (modified) llvm/include/llvm/IR/IRBuilder.h (+15-63) 
- (modified) llvm/include/llvm/IR/Instruction.h (+6-2) 
- (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h 
(+1-3) 
- (modified) llvm/lib/Analysis/MemoryBuiltins.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/AtomicExpandPass.cpp (+4-4) 
- (modified) llvm/lib/CodeGen/CodeGenPrepare.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/ExpandLargeFpConvert.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/ExpandMemCmp.cpp (+3-3) 
- (modified) llvm/lib/CodeGen/ExpandVectorPredication.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/HardwareLoops.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/IntrinsicLowering.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/SafeStack.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/ShadowStackGCLowering.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/SjLjEHPrepare.cpp (+2-3) 
- (modified) llvm/lib/CodeGen/WasmEHPrepare.cpp (+1-1) 
- (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+13-16) 
- (modified) llvm/lib/IR/AutoUpgrade.cpp (+2-2) 
- (modified) llvm/lib/IR/Core.cpp (+1-1) 
- (modified) llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp (+2-2) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp (+1-1) 
- (modified) llvm/lib/Target/ARM/ARMParallelDSP.cpp (+2-4) 
- (modified) llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp (+1-1) 
- (modified) llvm/lib/Target/ARM/MVETailPredication.cpp (+1-1) 
- (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+2-2) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp (+2-4) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp (+1-1) 
- (modified) llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp (+1-1) 
- (modified) llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp (+1-1) 
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp 
(+1-1) 
- (modified) llvm/lib/Target/X86/X86LowerAMXIntrinsics.cpp (+2-2) 
- (modified) llvm/lib/Target/X86/X86LowerAMXType.cpp (+1-2) 
- (modified) llvm/lib/Target/X86/X86WinEHState.cpp (+1-1) 
- (modified) 
llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+5-7) 
- (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+1-1) 
- (modified) llvm/lib/Transforms/IPO/OpenMPOpt.cpp (+1-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (+1-1) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+2-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (+2-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp (+1-1) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp (+2-3) 
- (modified) llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp (+2-2) 
- (modified) llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (+22-22) 
- (modified) llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp (+1-1) 
- (modified) 

[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-backend-powerpc

Author: Stephen Tozer (SLTozer)


Changes

Uses the new InsertPosition class (added in #94226) to simplify some of 
the IRBuilder interface, and removes the need to pass a BasicBlock alongside a 
BasicBlock::iterator, using the fact that we can now get the parent basic block 
from the iterator even if it points to the sentinel. This patch removes the 
BasicBlock argument from each constructor or call to setInsertPoint.

This has no functional effect, but later on as we look to remove the 
`Instruction *InsertBefore` argument from instruction-creation (discussed 
[here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)),
 this will simplify the process by allowing us to deprecate the InsertPosition 
constructor directly and catch all the cases where we use instructions rather 
than iterators.

---

Patch is 122.75 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/96497.diff


97 Files Affected:

- (modified) clang/lib/CodeGen/CGBlocks.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGGPUBuiltin.cpp (+2-2) 
- (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGObjC.cpp (+3-4) 
- (modified) clang/lib/CodeGen/CGObjCMac.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CGStmt.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenABITypes.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+2-2) 
- (modified) llvm/include/llvm/IR/IRBuilder.h (+15-63) 
- (modified) llvm/include/llvm/IR/Instruction.h (+6-2) 
- (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h 
(+1-3) 
- (modified) llvm/lib/Analysis/MemoryBuiltins.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/AtomicExpandPass.cpp (+4-4) 
- (modified) llvm/lib/CodeGen/CodeGenPrepare.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/ExpandLargeFpConvert.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/ExpandMemCmp.cpp (+3-3) 
- (modified) llvm/lib/CodeGen/ExpandVectorPredication.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/HardwareLoops.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/IntrinsicLowering.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/SafeStack.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/ShadowStackGCLowering.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/SjLjEHPrepare.cpp (+2-3) 
- (modified) llvm/lib/CodeGen/WasmEHPrepare.cpp (+1-1) 
- (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+13-16) 
- (modified) llvm/lib/IR/AutoUpgrade.cpp (+2-2) 
- (modified) llvm/lib/IR/Core.cpp (+1-1) 
- (modified) llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp (+2-2) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp (+1-1) 
- (modified) llvm/lib/Target/ARM/ARMParallelDSP.cpp (+2-4) 
- (modified) llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp (+1-1) 
- (modified) llvm/lib/Target/ARM/MVETailPredication.cpp (+1-1) 
- (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+2-2) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp (+2-4) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp (+1-1) 
- (modified) llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp (+1-1) 
- (modified) llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp (+1-1) 
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp 
(+1-1) 
- (modified) llvm/lib/Target/X86/X86LowerAMXIntrinsics.cpp (+2-2) 
- (modified) llvm/lib/Target/X86/X86LowerAMXType.cpp (+1-2) 
- (modified) llvm/lib/Target/X86/X86WinEHState.cpp (+1-1) 
- (modified) 
llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+5-7) 
- (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+1-1) 
- (modified) llvm/lib/Transforms/IPO/OpenMPOpt.cpp (+1-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (+1-1) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+2-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (+2-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp (+1-1) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp (+2-3) 
- (modified) llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp (+2-2) 
- (modified) llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (+22-22) 
- (modified) llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp (+1-1) 
- (modified) 

[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Stephen Tozer via cfe-commits

https://github.com/SLTozer edited 
https://github.com/llvm/llvm-project/pull/96497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits