[llvm-bugs] [Bug 51608] New: GlobalOpt asserts with "Should be GlobalVariable"

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 24 14:48:33 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51608

            Bug ID: 51608
           Summary: GlobalOpt asserts with "Should be GlobalVariable"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: alina.sbirlea at gmail.com
                CC: llvm-bugs at lists.llvm.org

Reproduces with "opt -passes=globalopt test.ll" on:

%sometype = type { i8* }

@map = internal unnamed_addr global %sometype* null, align 8

define void @Init() {
entry:
  %call = tail call noalias nonnull dereferenceable(48) i8* @_Znwm(i64 48)
  store i8* %call, i8** bitcast (%sometype** @map to i8**), align 8
  ret void
}

define void @Usage() {
entry:
  %0 = load i8*, i8** bitcast (%sometype** @map to i8**), align 8
  %.not = icmp eq i8* %0, null
  unreachable
}

declare i8* @_Znwm(i64)

Assertion details:
llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:708: bool
AllUsesOfValueWillTrapIfNull(const llvm::Value *, SmallPtrSetImpl<const
llvm::PHINode *> &): Assertion `isa<GlobalValue>(
cast<LoadInst>(U->getOperand(0))->getPointerOperand()) && "Should be
GlobalVariable"' failed.

[...]
#10 0x000000000747c411 AllUsesOfValueWillTrapIfNull(llvm::Value const*,
llvm::SmallPtrSetImpl<llvm::PHINode const*>&)
llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:712:5
#11 0x000000000747b11a allUsesOfLoadedValueWillTrapIfNull(llvm::GlobalVariable
const*) llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:731:13
#12 0x000000000747a9fa
tryToOptimizeStoreOfMallocToGlobal(llvm::GlobalVariable*, llvm::CallInst*,
llvm::Type*, llvm::AtomicOrdering, llvm::DataLayout const&,
llvm::TargetLibraryInfo*)
llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:1118:7
#13 0x00000000074784b4 optimizeOnceStoredGlobal(llvm::GlobalVariable*,
llvm::Value*, llvm::AtomicOrdering, llvm::DataLayout const&,
llvm::function_ref<llvm::TargetLibraryInfo& (llvm::Function&)>)
llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:1178:11
#14 0x0000000007475758 processInternalGlobal(llvm::GlobalVariable*,
llvm::GlobalStatus const&, llvm::function_ref<llvm::TargetLibraryInfo&
(llvm::Function&)>, llvm::function_ref<llvm::DominatorTree& (llvm::Function&)>)
llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:1633:9
#15 0x0000000007473c20 processGlobal(llvm::GlobalValue&,
llvm::function_ref<llvm::TargetLibraryInfo& (llvm::Function&)>,
llvm::function_ref<llvm::DominatorTree& (llvm::Function&)>)
llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:1688:65
[...]

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210824/a23b7a7a/attachment.html>


More information about the llvm-bugs mailing list