From: Nikita Popov Date: Wed, 17 May 2023 13:19:35 +0000 (+0200) Subject: [InstCombine] Create store using IRBuilder X-Git-Tag: upstream/17.0.6~8151 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6170bb895917e69793fe2125bb79d2991183492b;p=platform%2Fupstream%2Fllvm.git [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). --- diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index a069a0b..e30e8d0 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 15716b6..5a3343e 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"