llvm-project/llvm/lib/Transforms/Utils
Max Kazantsev 86d5586d78 [SCEVExpander] Recompute poison-generating flags on hoisting. PR57187
Instruction being hoisted could have nuw/nsw flags inferred from the old
context, and we cannot simply move it to the new location keeping them
because we are going to introduce new uses to them that didn't exist before.

Example in https://github.com/llvm/llvm-project/issues/57187 shows how
this can produce branch by poison from initially well-defined program.

This patch forcefully recomputes poison-generating flag in the new context.

Differential Revision: https://reviews.llvm.org/D132022
Reviewed By: fhahn, nikic
2022-09-13 12:56:35 +07:00
..
AMDGPUEmitPrintf.cpp [AMDGPU] replace hostcall module flag with function attribute 2022-02-11 22:51:56 +05:30
ASanStackFrameLayout.cpp Cleanup includes: TransformsUtils 2022-03-01 21:00:07 +01:00
AddDiscriminators.cpp [llvm] Don't use Optional::getValue (NFC) 2022-06-20 22:45:45 -07:00
AssumeBundleBuilder.cpp Cleanup includes: TransformsUtils 2022-03-01 21:00:07 +01:00
BasicBlockUtils.cpp Use PoisonValue instead of UndefValue when RAUWing unreachable code [NFC] 2022-09-10 14:28:01 +01:00
BreakCriticalEdges.cpp [BasicBlockUtils] Allow critical edge splitting with callbr terminators 2022-07-08 09:20:44 +02:00
BuildLibCalls.cpp [InstCombine] Remove assumptions about int having 32 bits 2022-08-16 15:35:08 -06:00
BypassSlowDivision.cpp
CMakeLists.txt [misexpect] Re-implement MisExpect Diagnostics 2022-04-19 21:23:48 +00:00
CallGraphUpdater.cpp Use PoisonValue instead of UndefValue when RAUWing unreachable code [NFC] 2022-09-10 14:28:01 +01:00
CallPromotionUtils.cpp [WPD] Extend checking mode to support fallback to indirect call 2022-03-14 10:16:28 -07:00
CanonicalizeAliases.cpp [llvm] Fix comment typos (NFC) 2022-08-07 00:16:14 -07:00
CanonicalizeFreezeInLoops.cpp Cleanup includes: TransformsUtils 2022-03-01 21:00:07 +01:00
CloneFunction.cpp [llvm] Qualify auto (NFC) 2022-08-07 23:55:27 -07:00
CloneModule.cpp Cleanup includes: TransformsUtils 2022-03-01 21:00:07 +01:00
CodeExtractor.cpp [Transform] Use range-based for loops (NFC) 2022-08-27 23:54:32 -07:00
CodeLayout.cpp [Transforms] Qualify auto in range-based for loops (NFC) 2022-08-27 21:21:02 -07:00
CodeMoverUtils.cpp [llvm] Qualify auto in range-based for loops (NFC) 2022-08-13 12:55:42 -07:00
CtorUtils.cpp [GlobalOpt] Enable optimization of constructors with different priorities 2022-05-13 22:19:29 +00:00
Debugify.cpp [Debugify] Port verify-debuginfo-preserve to NewPM 2022-07-06 17:07:20 +02:00
DemoteRegToStack.cpp Cleanup includes: TransformsUtils 2022-03-01 21:00:07 +01:00
EntryExitInstrumenter.cpp [LegacyPM] Remove {,PostInline}EntryExitInstrumenterPass 2022-07-23 15:30:15 -07:00
EscapeEnumerator.cpp
Evaluator.cpp [Transform] Use range-based for loops (NFC) 2022-08-27 23:54:32 -07:00
FixIrreducible.cpp [Transforms] Qualify auto in range-based for loops (NFC) 2022-08-27 21:21:02 -07:00
FlattenCFG.cpp [Transform] Use range-based for loops (NFC) 2022-08-27 23:54:32 -07:00
FunctionComparator.cpp [llvm] Qualify auto (NFC) 2022-08-07 23:55:27 -07:00
FunctionImportUtils.cpp [Transforms] Qualify auto in range-based for loops (NFC) 2022-08-14 12:51:58 -07:00
GlobalStatus.cpp [GlobalOpt] Perform store->dominated load forwarding for stored once globals 2022-06-24 09:09:26 -07:00
GuardUtils.cpp
HelloWorld.cpp
InjectTLIMappings.cpp Cleanup includes: TransformsUtils 2022-03-01 21:00:07 +01:00
InlineFunction.cpp KCFI sanitizer 2022-08-24 22:41:38 +00:00
InstructionNamer.cpp
IntegerDivision.cpp Expand Div/Rem: consider the case where the dividend is zero 2022-09-01 17:04:26 +01:00
LCSSA.cpp [LCSSA] Update unreachable uses with poison. 2022-09-04 22:26:18 +01:00
LibCallsShrinkWrap.cpp Cleanup includes: TransformsUtils 2022-03-01 21:00:07 +01:00
Local.cpp reland: [Local] Allow creating callbr with duplicate successors 2022-08-31 13:23:00 -07:00
LoopPeel.cpp Remove redundant initialization of Optional (NFC) 2022-08-20 21:18:28 -07:00
LoopRotationUtils.cpp [TTI] NFC: Reduce InstructionCost::getValue() usage... 2022-08-26 16:37:32 +03:00
LoopSimplify.cpp [Transform] Use range-based for loops (NFC) 2022-08-27 23:54:32 -07:00
LoopUnroll.cpp Use std::gcd (NFC) 2022-08-27 21:20:59 -07:00
LoopUnrollAndJam.cpp [llvm] Don't use Optional::getValue (NFC) 2022-06-20 22:45:45 -07:00
LoopUnrollRuntime.cpp [Transforms] Fix comment typos (NFC) 2022-08-07 23:55:24 -07:00
LoopUtils.cpp [llvm] Use x.empty() instead of llvm::empty(x) (NFC) 2022-09-12 13:34:35 -07:00
LoopVersioning.cpp
LowerAtomic.cpp [NFC] Switch a few uses of undef to poison as placeholders for unreachable code 2022-07-23 21:50:11 +01:00
LowerGlobalDtors.cpp [Transforms] Qualify auto in range-based for loops (NFC) 2022-08-27 21:21:02 -07:00
LowerInvoke.cpp Cleanup includes: TransformsUtils 2022-03-01 21:00:07 +01:00
LowerMemIntrinsics.cpp [Transforms] Qualify auto in range-based for loops (NFC) 2022-08-27 21:21:02 -07:00
LowerSwitch.cpp LowerSwitch: Avoid inserting NewDefault block 2022-04-14 13:30:56 +08:00
MatrixUtils.cpp [Matrix] Refactor tiled loops in a struct. NFC 2022-07-26 11:02:22 -07:00
Mem2Reg.cpp
MemoryOpRemark.cpp
MemoryTaggingSupport.cpp [NFC] Use AllocaInst's getAddressSpace helper 2022-08-01 10:11:16 +01:00
MetaRenamer.cpp [llvm] Use std::size instead of llvm::array_lengthof 2022-09-08 09:01:53 -06:00
MisExpect.cpp [llvm][misexpect] Re-enable MisExpect for SampleProfiling 2022-08-26 20:24:10 +00:00
ModuleUtils.cpp [llvm] Use value instead of getValue (NFC) 2022-07-13 23:11:56 -07:00
NameAnonGlobals.cpp [LegacyPM] Remove NameAnonGlobalLegacyPass 2022-07-17 14:38:29 -07:00
PredicateInfo.cpp [Transforms] Qualify auto in range-based for loops (NFC) 2022-08-27 21:21:02 -07:00
PromoteMemoryToRegister.cpp [Mem2Reg] Consistently preserve nonnull assume for uninit load 2022-07-12 12:53:08 +02:00
RelLookupTableConverter.cpp [RelLookupTableConverter] Bail on invalid pointer size (x32) 2022-08-09 09:36:39 +02:00
SCCPSolver.cpp [SCCP] Make check for unknown/undef in unary op handling more explicit (NFCI) 2022-07-14 10:56:11 +02:00
SSAUpdater.cpp [NFC] Switch a few uses of undef to poison as placeholders for unreachable code 2022-07-30 13:55:56 +01:00
SSAUpdaterBulk.cpp
SampleProfileInference.cpp [llvm] Use range-based for loops (NFC) 2022-09-03 11:17:40 -07:00
SampleProfileLoaderBaseUtil.cpp Remove unneeded cl::ZeroOrMore for cl::opt/cl::list options 2022-06-05 00:31:44 -07:00
SanitizerStats.cpp Cleanup includes: TransformsUtils 2022-03-01 21:00:07 +01:00
ScalarEvolutionExpander.cpp [SCEVExpander] Recompute poison-generating flags on hoisting. PR57187 2022-09-13 12:56:35 +07:00
SimplifyCFG.cpp [SimplifyCFG] Allow SimplifyCFG hoisting to skip over non-matching instructions 2022-09-05 15:13:46 +01:00
SimplifyIndVar.cpp [SCEV] Prove condition invariance via context, try 2 2022-08-22 14:31:19 +07:00
SimplifyLibCalls.cpp [InstCombine] convert second std::min argument to same type as first 2022-08-16 17:34:33 -06:00
SizeOpts.cpp [llvm] Remove unneeded cl::ZeroOrMore for cl::opt options. NFC 2022-06-03 21:59:05 -07:00
SplitModule.cpp [llvm] Qualify auto in range-based for loops (NFC) 2022-08-13 12:55:42 -07:00
StripGCRelocates.cpp [NFC] Rename Instrinsic to Intrinsic 2022-04-25 18:13:23 +01:00
StripNonLineTableDebugInfo.cpp
SymbolRewriter.cpp Cleanup includes: TransformsUtils 2022-03-01 21:00:07 +01:00
UnifyFunctionExitNodes.cpp
UnifyLoopExits.cpp [Transforms] Qualify auto in range-based for loops (NFC) 2022-08-27 21:21:02 -07:00
Utils.cpp [LegacyPM] Remove NameAnonGlobalLegacyPass 2022-07-17 14:38:29 -07:00
VNCoercion.cpp [VNCoercion] Separate constant/non-constant mem intrinsic implementations (NFCI) 2022-06-30 15:26:06 +02:00
ValueMapper.cpp