[llvm] 6170bb8 - [InstCombine] Create store using IRBuilder
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed May 17 06:20:30 PDT 2023
Author: Nikita Popov
Date: 2023-05-17T15:20:21+02:00
New Revision: 6170bb895917e69793fe2125bb79d2991183492b
URL: https://github.com/llvm/llvm-project/commit/6170bb895917e69793fe2125bb79d2991183492b
DIFF: https://github.com/llvm/llvm-project/commit/6170bb895917e69793fe2125bb79d2991183492b.diff
LOG: [InstCombine] Create store using IRBuilder
This ensures it gets reprocessed in the same iteration. In
particular the alignment will be increased (which is quite
pointless, of course).
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
llvm/test/Transforms/InstCombine/getelementptr.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
index a069a0b49811..e30e8d02ec54 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -1100,9 +1100,8 @@ Instruction *InstCombinerImpl::visitLoadInst(LoadInst &LI) {
// that this code is not reachable. We do this instead of inserting
// an unreachable instruction directly because we cannot modify the
// CFG.
- StoreInst *SI = new StoreInst(PoisonValue::get(LI.getType()),
- Constant::getNullValue(Op->getType()), &LI);
- SI->setDebugLoc(LI.getDebugLoc());
+ Builder.CreateStore(PoisonValue::get(LI.getType()),
+ Constant::getNullValue(Op->getType()));
return replaceInstUsesWith(LI, PoisonValue::get(LI.getType()));
}
diff --git a/llvm/test/Transforms/InstCombine/getelementptr.ll b/llvm/test/Transforms/InstCombine/getelementptr.ll
index 15716b68defd..5a3343e02757 100644
--- a/llvm/test/Transforms/InstCombine/getelementptr.ll
+++ b/llvm/test/Transforms/InstCombine/getelementptr.ll
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -passes=instcombine -S | FileCheck %s
+; RUN: opt < %s -passes=instcombine -instcombine-infinite-loop-threshold=2 -S | FileCheck %s
target datalayout = "e-p:64:64-p1:16:16-p2:32:32:32-p3:64:64:64"
More information about the llvm-commits
mailing list