[llvm] [WIP][AMDGPU] Enable "amdgpu-uniform-intrinsic-combine" pass in pipeline. (PR #128687)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 10 02:02:25 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- llvm/lib/Target/AMDGPU/AMDGPU.h llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp llvm/lib/Target/AMDGPU/AMDGPUUniformIntrinsicCombine.cpp
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUUniformIntrinsicCombine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUUniformIntrinsicCombine.cpp
index cdd6df940..45466542b 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUUniformIntrinsicCombine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUUniformIntrinsicCombine.cpp
@@ -99,48 +99,48 @@ static bool optimizeUniformIntrinsic(IntrinsicInst &II,
return false;
LLVM_DEBUG(dbgs() << "Found uniform ballot intrinsic: " << II << '\n');
- ICmpInst::Predicate Pred = ICmp->getPredicate();
- Value *OtherOp = Op0 == &II ? Op1 : Op0;
+ ICmpInst::Predicate Pred = ICmp->getPredicate();
+ Value *OtherOp = Op0 == &II ? Op1 : Op0;
- if (Pred == ICmpInst::ICMP_EQ && match(OtherOp, m_Zero())) {
+ if (Pred == ICmpInst::ICMP_EQ && match(OtherOp, m_Zero())) {
<<<<<<< HEAD
<<<<<<< HEAD
- // Case: (icmp eq %ballot, 0) -> xor %ballot_arg, 1
- Instruction *NotOp =
- BinaryOperator::CreateNot(Src, "", ICmp->getIterator());
- Tracker[NotOp] = true; // NOT preserves uniformity
+ // Case: (icmp eq %ballot, 0) -> xor %ballot_arg, 1
+ Instruction *NotOp =
+ BinaryOperator::CreateNot(Src, "", ICmp->getIterator());
+ Tracker[NotOp] = true; // NOT preserves uniformity
=======
- // Case (icmp eq %ballot, 0) --> xor %ballot_arg, 1
- Instruction *NotOp =
- BinaryOperator::CreateNot(Src, "", ICmp->getIterator());
+ // Case (icmp eq %ballot, 0) --> xor %ballot_arg, 1
+ Instruction *NotOp =
+ BinaryOperator::CreateNot(Src, "", ICmp->getIterator());
>>>>>>> ee370a5a77ca ([AMDGPU] combine uniform AMDGPU lane Intrinsics)
=======
- // Case: (icmp eq %ballot, 0) -> xor %ballot_arg, 1
- Instruction *NotOp =
- BinaryOperator::CreateNot(Src, "", ICmp->getIterator());
- // Record uniformity: Src is uniform, and NOT preserves uniformity.
- NewUMap[NotOp] = true;
+ // Case: (icmp eq %ballot, 0) -> xor %ballot_arg, 1
+ Instruction *NotOp =
+ BinaryOperator::CreateNot(Src, "", ICmp->getIterator());
+ // Record uniformity: Src is uniform, and NOT preserves uniformity.
+ NewUMap[NotOp] = true;
>>>>>>> f6cc7aa1522d (store newly inserted inst and its uniformity)
- LLVM_DEBUG(dbgs() << "Replacing ICMP_EQ: " << *NotOp << '\n');
- ICmp->replaceAllUsesWith(NotOp);
- ICmp->eraseFromParent();
- Changed = true;
- } else if (Pred == ICmpInst::ICMP_NE && match(OtherOp, m_Zero())) {
+ LLVM_DEBUG(dbgs() << "Replacing ICMP_EQ: " << *NotOp << '\n');
+ ICmp->replaceAllUsesWith(NotOp);
+ ICmp->eraseFromParent();
+ Changed = true;
+ } else if (Pred == ICmpInst::ICMP_NE && match(OtherOp, m_Zero())) {
<<<<<<< HEAD
<<<<<<< HEAD
- // Case: (icmp ne %ballot, 0) -> %ballot_arg
+ // Case: (icmp ne %ballot, 0) -> %ballot_arg
=======
- // (icmp ne %ballot, 0) --> %ballot_arg
+ // (icmp ne %ballot, 0) --> %ballot_arg
>>>>>>> ee370a5a77ca ([AMDGPU] combine uniform AMDGPU lane Intrinsics)
=======
- // Case: (icmp ne %ballot, 0) -> %ballot_arg
+ // Case: (icmp ne %ballot, 0) -> %ballot_arg
>>>>>>> f6cc7aa1522d (store newly inserted inst and its uniformity)
- LLVM_DEBUG(dbgs() << "Replacing ICMP_NE with ballot argument: "
- << *Src << '\n');
- ICmp->replaceAllUsesWith(Src);
- ICmp->eraseFromParent();
- Changed = true;
- }
+ LLVM_DEBUG(dbgs() << "Replacing ICMP_NE with ballot argument: " << *Src
+ << '\n');
+ ICmp->replaceAllUsesWith(Src);
+ ICmp->eraseFromParent();
+ Changed = true;
+ }
}
}
// Erase the intrinsic if it has no remaining uses.
@@ -204,7 +204,7 @@ static bool runUniformIntrinsicCombine(Module &M, ModuleAnalysisManager &AM) {
IsChanged |= optimizeUniformIntrinsic(*II, UI);
>>>>>>> ee370a5a77ca ([AMDGPU] combine uniform AMDGPU lane Intrinsics)
=======
- IsChanged |= optimizeUniformIntrinsic(*II, UI, NewUMap);
+ IsChanged |= optimizeUniformIntrinsic(*II, UI, NewUMap);
>>>>>>> f6cc7aa1522d (store newly inserted inst and its uniformity)
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/128687
More information about the llvm-commits
mailing list