[PATCH] D141164: [AAUnderlyingObjects] Introduce an AA for getting underlying objects of a pointer

Shilei Tian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 15:12:39 PST 2023


tianshilei1992 added a comment.

In D141164#4037866 <https://reviews.llvm.org/D141164#4037866>, @cmtice wrote:

> Just a heads up: This is causing some of our clang tests to fail when run under asan/ubasn. E.g. for llvm/test/Transforms:Attributor/nosync.ll.test, we get
>
> exit status 2
> third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:1158:26: runtime error: load of value 112, which is not a valid value for type 'bool'
>
>   #0 0x560ddce60c4b in llvm::Attributor::getAssumedSimplifiedValues(llvm::IRPosition const&, llvm::AbstractAttribute const*, llvm::SmallVectorImpl<llvm::AA::ValueAndContext>&, llvm::AA::ValueScope, bool&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:1158:26
>   #1 0x560ddcf1fda2 in (anonymous namespace)::AAUnderlyingObjectsImpl::updateImpl(llvm::Attributor&)::'lambda'(llvm::SmallSetVector<llvm::Value*, 8u>&, llvm::AA::ValueScope)::operator()(llvm::SmallSetVector<llvm::Value*, 8u>&, llvm::AA::ValueScope) const third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:11235:14
>   #2 0x560ddcf1f4f1 in (anonymous namespace)::AAUnderlyingObjectsImpl::updateImpl(llvm::Attributor&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:11272:16
>   #3 0x560ddce5d771 in llvm::AbstractAttribute::update(llvm::Attributor&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:792:16
>   #4 0x560ddce69fe0 in llvm::Attributor::updateAA(llvm::AbstractAttribute&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:2302:13
>   #5 0x560ddce939de in llvm::AAUnderlyingObjects const& llvm::Attributor::getOrCreateAAFor<llvm::AAUnderlyingObjects>(llvm::IRPosition, llvm::AbstractAttribute const*, llvm::DepClassTy, bool, bool) third_party/llvm/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:1562:7
>   #6 0x560ddce5a418 in getAAFor<llvm::AAUnderlyingObjects> third_party/llvm/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:1462:12
>   #7 0x560ddce5a418 in getPotentialCopiesOfMemoryValue<true, llvm::LoadInst> third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:488:24
>   #8 0x560ddce5a418 in llvm::AA::getPotentiallyLoadedValues(llvm::Attributor&, llvm::LoadInst&, llvm::SmallSetVector<llvm::Value*, 4u>&, llvm::SmallSetVector<llvm::Instruction*, 4u>&, llvm::AbstractAttribute const&, bool&, bool) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:515:10
>   #9 0x560ddcef9967 in handleLoadInst third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:10572:10
>   #10 0x560ddcef9967 in simplifyInstruction third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:10739:14
>   #11 0x560ddcef9967 in genericValueTraversal third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:10796:13
>   #12 0x560ddcef9967 in (anonymous namespace)::AAPotentialValuesFloating::updateImpl(llvm::Attributor&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:10450:5
>   #13 0x560ddce5d771 in llvm::AbstractAttribute::update(llvm::Attributor&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:792:16
>   #14 0x560ddce69fe0 in llvm::Attributor::updateAA(llvm::AbstractAttribute&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:2302:13
>   #15 0x560ddce82d0e in llvm::AAPotentialValues const& llvm::Attributor::getOrCreateAAFor<llvm::AAPotentialValues>(llvm::IRPosition, llvm::AbstractAttribute const*, llvm::DepClassTy, bool, bool) third_party/llvm/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:1562:7
>   #16 0x560ddce60a77 in llvm::Attributor::getAssumedSimplifiedValues(llvm::IRPosition const&, llvm::AbstractAttribute const*, llvm::SmallVectorImpl<llvm::AA::ValueAndContext>&, llvm::AA::ValueScope, bool&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:1155:7
>   #17 0x560ddcebe5bb in operator() third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:2129:12
>   #18 0x560ddcebe5bb in bool llvm::function_ref<bool (llvm::Instruction&)>::callback_fn<(anonymous namespace)::AAReturnedValuesImpl::updateImpl(llvm::Attributor&)::$_0>(long, llvm::Instruction&) third_party/llvm/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
>   #19 0x560ddce66cb5 in operator() third_party/llvm/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
>   #20 0x560ddce66cb5 in checkForAllInstructionsImpl(llvm::Attributor*, llvm::DenseMap<unsigned int, llvm::SmallVector<llvm::Instruction*, 8u>*, llvm::DenseMapInfo<unsigned int, void>, llvm::detail::DenseMapPair<unsigned int, llvm::SmallVector<llvm::Instruction*, 8u>*>>&, llvm::function_ref<bool (llvm::Instruction&)>, llvm::AbstractAttribute const*, llvm::AAIsDead const*, llvm::ArrayRef<unsigned int> const&, bool&, bool, bool) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:1653:12
>   #21 0x560ddce66f5a in checkForAllInstructions third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:1679:8
>   #22 0x560ddce66f5a in llvm::Attributor::checkForAllInstructions(llvm::function_ref<bool (llvm::Instruction&)>, llvm::AbstractAttribute const&, llvm::ArrayRef<unsigned int> const&, bool&, bool, bool) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:1695:10
>   #23 0x560ddcebd7a3 in (anonymous namespace)::AAReturnedValuesImpl::updateImpl(llvm::Attributor&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:2145:10
>   #24 0x560ddce5d771 in llvm::AbstractAttribute::update(llvm::Attributor&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:792:16
>   #25 0x560ddce69fe0 in llvm::Attributor::updateAA(llvm::AbstractAttribute&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:2302:13
>   #26 0x560ddce95f2e in llvm::AAReturnedValues const& llvm::Attributor::getOrCreateAAFor<llvm::AAReturnedValues>(llvm::IRPosition, llvm::AbstractAttribute const*, llvm::DepClassTy, bool, bool) third_party/llvm/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:1562:7
>   #27 0x560ddce6683d in getAAFor<llvm::AAReturnedValues> third_party/llvm/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:1462:12
>   #28 0x560ddce6683d in llvm::Attributor::checkForAllReturnedValues(llvm::function_ref<bool (llvm::Value&)>, llvm::AbstractAttribute const&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:1620:7
>   #29 0x560ddcf05211 in clampReturnedValueStates<llvm::AANoUndef, llvm::BooleanState> third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:396:10
>   #30 0x560ddcf05211 in (anonymous namespace)::AAReturnedFromReturnedValues<llvm::AANoUndef, (anonymous namespace)::AANoUndefImpl, llvm::BooleanState, false>::updateImpl(llvm::Attributor&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:414:5
>   #31 0x560ddce5d771 in llvm::AbstractAttribute::update(llvm::Attributor&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:792:16
>   #32 0x560ddce69fe0 in llvm::Attributor::updateAA(llvm::AbstractAttribute&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:2302:13
>   #33 0x560ddcea2ede in llvm::AANoUndef const& llvm::Attributor::getOrCreateAAFor<llvm::AANoUndef>(llvm::IRPosition, llvm::AbstractAttribute const*, llvm::DepClassTy, bool, bool) third_party/llvm/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:1562:7
>   #34 0x560ddcf2a82c in getAAFor<llvm::AANoUndef> third_party/llvm/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:1462:12
>   #35 0x560ddcf2a82c in (anonymous namespace)::AAUndefinedBehaviorImpl::updateImpl(llvm::Attributor&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:3007:15
>   #36 0x560ddce5d771 in llvm::AbstractAttribute::update(llvm::Attributor&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:792:16
>   #37 0x560ddce69fe0 in llvm::Attributor::updateAA(llvm::AbstractAttribute&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:2302:13
>   #38 0x560ddce9d2fe in llvm::AAUndefinedBehavior const& llvm::Attributor::getOrCreateAAFor<llvm::AAUndefinedBehavior>(llvm::IRPosition, llvm::AbstractAttribute const*, llvm::DepClassTy, bool, bool) third_party/llvm/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:1562:7
>   #39 0x560ddce75da4 in getOrCreateAAFor<llvm::AAUndefinedBehavior> third_party/llvm/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:1574:12
>   #40 0x560ddce75da4 in llvm::Attributor::identifyDefaultAbstractAttributes(llvm::Function&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:2935:3
>   #41 0x560ddce79dbb in runAttributorOnFunctions(llvm::InformationCache&, llvm::SetVector<llvm::Function*, std::__u::vector<llvm::Function*, std::__u::allocator<llvm::Function*>>, llvm::DenseSet<llvm::Function*, llvm::DenseMapInfo<llvm::Function*, void>>>&, llvm::AnalysisGetter&, llvm::CallGraphUpdater&, bool, bool) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:3372:7
>   #42 0x560ddce792c9 in llvm::AttributorPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:3423:7
>   #43 0x560ddbd0a6d1 in llvm::detail::PassModel<llvm::Module, llvm::AttributorPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) third_party/llvm/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:89:17
>   #44 0x560dded5a873 in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) third_party/llvm/llvm-project/llvm/include/llvm/IR/PassManager.h:517:40
>   #45 0x560dd9e41b4d in llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool) third_party/llvm/llvm-project/llvm/tools/opt/NewPMDriver.cpp:512:7
>   #46 0x560dd9e5c422 in main third_party/llvm/llvm-project/llvm/tools/opt/opt.cpp:726:12
>   #47 0x7f116010d632 in __libc_start_main (/usr/grte/v5/lib64/libc.so.6+0x61632) (BuildId: 280088eab084c30a3992a9bce5c35b44)
>   #48 0x560dd9d69869 in _start /build/work/ab393f4ac612f9027aae6b1a7226027ba2a2/google3/blaze-out/k8-opt/bin/third_party/grte/v5_src/grte-scratch/BUILD/src/csu/../sysdeps/x86_64/start.S:120
>
> SUMMARY: UndefinedBehaviorSanitizer: invalid-bool-load third_party/llvm/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:1158:26 in 
> FileCheck error: '<stdin>' is empty.
>
> I will see if I can get you the actual commands to reproduce this...

That would be helpful. Thanks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141164/new/

https://reviews.llvm.org/D141164



More information about the llvm-commits mailing list