[llvm] [FlattenCFG] Fix an Imprecise Usage of AA (PR #128117)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 24 17:43:41 PST 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 f27081ba6a12685b403181e51a00a3d6f3360ca5 12293ce3b018ef74507e62f2317c6b1d94322272 --extensions cpp,h -- llvm/include/llvm/Analysis/AliasAnalysis.h llvm/unittests/Analysis/AliasAnalysisTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/unittests/Analysis/AliasAnalysisTest.cpp b/llvm/unittests/Analysis/AliasAnalysisTest.cpp
index 6c116bd168..bbed1e0aa8 100644
--- a/llvm/unittests/Analysis/AliasAnalysisTest.cpp
+++ b/llvm/unittests/Analysis/AliasAnalysisTest.cpp
@@ -367,10 +367,9 @@ TEST_F(AliasAnalysisTest, PartialAliasOffsetSign) {
 
 TEST_F(AliasAnalysisTest, IsNoAliasForInstructions) {
   // Create global variable
-  auto *GlobalVar = new GlobalVariable(M, Type::getInt32Ty(C), false,
-                                     GlobalValue::ExternalLinkage, 
-                                     ConstantInt::get(Type::getInt32Ty(C), 0),
-                                     "g");
+  auto *GlobalVar = new GlobalVariable(
+      M, Type::getInt32Ty(C), false, GlobalValue::ExternalLinkage,
+      ConstantInt::get(Type::getInt32Ty(C), 0), "g");
   GlobalVar->setAlignment(Align(4));
 
   // Create function declarations
@@ -380,15 +379,18 @@ TEST_F(AliasAnalysisTest, IsNoAliasForInstructions) {
 
   // Create test function
   FunctionType *TestFnTy = FunctionType::get(Type::getInt32Ty(C), false);
-  Function *TestFn = Function::Create(TestFnTy, Function::ExternalLinkage, "test", M);
-  
+  Function *TestFn =
+      Function::Create(TestFnTy, Function::ExternalLinkage, "test", M);
+
   // Create basic block
   BasicBlock *BB = BasicBlock::Create(C, "entry", TestFn);
-  
+
   // Create instructions
   auto *Alloca = new AllocaInst(Type::getInt32Ty(C), 0, "p", BB);
-  auto *Store1 = new StoreInst(ConstantInt::get(Type::getInt32Ty(C), 42), Alloca, BB);
-  auto *Store2 = new StoreInst(ConstantInt::get(Type::getInt32Ty(C), 100), GlobalVar, BB);
+  auto *Store1 =
+      new StoreInst(ConstantInt::get(Type::getInt32Ty(C), 42), Alloca, BB);
+  auto *Store2 =
+      new StoreInst(ConstantInt::get(Type::getInt32Ty(C), 100), GlobalVar, BB);
   auto *Call1 = CallInst::Create(M.getFunction("foo"), {}, BB);
   auto *Call2 = CallInst::Create(M.getFunction("bar"), {}, BB);
   auto *Load = new LoadInst(Type::getInt32Ty(C), Alloca, "val", BB);
@@ -401,7 +403,6 @@ TEST_F(AliasAnalysisTest, IsNoAliasForInstructions) {
   EXPECT_EQ(false, AA.isNoAlias(Store2, Call1));
   EXPECT_EQ(false, AA.isNoAlias(Call1, Call2));
   EXPECT_EQ(true, AA.isNoAlias(Store2, Load));
-  
 }
 
 class AAPassInfraTest : public testing::Test {

``````````

</details>


https://github.com/llvm/llvm-project/pull/128117


More information about the llvm-commits mailing list