This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Improve modelling for pointer constants
ClosedPublic

Authored by lebedev.ri on Mar 7 2021, 10:30 AM.

Details

Summary

This is a continuation of D89456.

As it was suggested there, now that SCEV models PtrToInt,
we can try to improve SCEV's pointer handling.
In particular, i believe, i will need this in the future
to further fix SCEVAddExproperation type handling.

This removes special handling of ConstantPointerNull
from ScalarEvolution::createSCEV(), and add constant folding
into ScalarEvolution::getPtrToIntExpr().
This way, null constants stay as such in SCEV's.

Diff Detail

Event Timeline

lebedev.ri created this revision.Mar 7 2021, 10:30 AM
lebedev.ri requested review of this revision.Mar 7 2021, 10:30 AM
lebedev.ri edited the summary of this revision. (Show Details)

I cannot see the mentioned null constant handling? Is it because removing the ConstantPointerNull condition it falls back to the generic case that now does handle null constants?

llvm/lib/Analysis/ScalarEvolution.cpp
1076

[typo] an ptr2int

IIUC, this is to reduce ptr2int(int2ptr(x)) -> x?

polly/test/Isl/CodeGen/partial_write_impossible_restriction.ll
9–10

Does it crash or a CHECK-line not match?

polly/test/ScopInfo/constant_functions_outside_scop_as_unknown.ll
9 ↗(On Diff #328883)

Weird. A constant doesn't need to be parametrized.

polly/test/ScopInfo/memset_null.ll
16–22 ↗(On Diff #328883)

Mmmh, the test description says that the memset should not be modeled (I think it should have optimistically assumed that it is never executed)

lebedev.ri marked an inline comment as done.Mar 7 2021, 12:40 PM

Thank you for taking a look!

I cannot see the mentioned null constant handling?
Is it because removing the ConstantPointerNull condition it falls back to the generic case that now does handle null constants?

Null constant handling consists of not diffusing ConstantPointerNull into an integer zero, but keeping it as a pointer-typed SCEVUnknown.

Sorry, i have no clue about polly, i have never looked at it's code.

polly/test/Isl/CodeGen/partial_write_impossible_restriction.ll
9–10
FAIL: Polly :: Isl/CodeGen/partial_write_impossible_restriction.ll (1 of 1)
******************** TEST 'Polly :: Isl/CodeGen/partial_write_impossible_restriction.ll' FAILED ********************
Script:
--
: 'RUN: at line 1';   opt  -polly-process-unprofitable  -polly-remarks-minimal  -polly-use-llvm-names  -polly-import-jscop-dir=/repositories/llvm-project/polly/test/Isl/CodeGen  -polly-codegen-verify  -polly-stmt-granularity=bb -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-codegen -S < /repositories/llvm-project/polly/test/Isl/CodeGen/partial_write_impossible_restriction.ll | FileCheck /repositories/llvm-project/polly/test/Isl/CodeGen/partial_write_impossible_restriction.ll
--
Exit Code: 2

Command Output (stderr):
--
Reading JScop '%for.body344---%if.then.i.i1141.loopexit' in function 'partial_write_impossible_restriction' from '/repositories/llvm-project/polly/test/Isl/CodeGen/partial_write_impossible_restriction___%for.body344---%if.then.i.i1141.loopexit.jscop.transformed'.
No match for array 'MemRef2' in JScop.
LLVM ERROR: Tried to import a malformed jscop file.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Meinersbur added a comment.EditedMar 8 2021, 9:25 AM

This is my draft suggestion for changes required in Polly for this change. The main problem is that isZero() does not recognize a SCEVUnknown-wrapped ConstantNullExpr.

diff --git a/polly/lib/Analysis/ScopBuilder.cpp b/polly/lib/Analysis/ScopBuilder.cpp
index 4def17102925..d7cafb18e633 100644
--- a/polly/lib/Analysis/ScopBuilder.cpp
+++ b/polly/lib/Analysis/ScopBuilder.cpp
@@ -1760,6 +1760,10 @@ bool ScopBuilder::buildAccessMemIntrinsic(MemAccInst Inst, ScopStmt *Stmt) {
   //       as we know it would be undefined to execute this instruction anyway.
   if (DestAccFunc->isZero())
     return true;
+  if (auto *X = dyn_cast<SCEVUnknown>(DestAccFunc)) {
+    if (isa<ConstantPointerNull>(X->getValue()))
+      return true;
+  }

   auto *DestPtrSCEV = dyn_cast<SCEVUnknown>(SE.getPointerBase(DestAccFunc));
   assert(DestPtrSCEV);
@@ -1836,6 +1840,10 @@ bool ScopBuilder::buildAccessCallInst(MemAccInst Inst, ScopStmt *Stmt) {
       auto *ArgSCEV = SE.getSCEVAtScope(Arg, L);
       if (ArgSCEV->isZero())
         continue;
+      if (auto *X = dyn_cast<SCEVUnknown>(ArgSCEV)) {
+        if (isa<ConstantPointerNull>(X->getValue()))
+          return true;
+      }

       auto *ArgBasePtr = cast<SCEVUnknown>(SE.getPointerBase(ArgSCEV));
       addArrayAccess(Stmt, Inst, AccType, ArgBasePtr->getValue(),
diff --git a/polly/lib/Support/SCEVAffinator.cpp b/polly/lib/Support/SCEVAffinator.cpp
index 9d2e7d9a6fcb..1691b2aa242b 100644
--- a/polly/lib/Support/SCEVAffinator.cpp
+++ b/polly/lib/Support/SCEVAffinator.cpp
@@ -551,8 +551,15 @@ PWACtx SCEVAffinator::visitUnknown(const SCEVUnknown *Expr) {
     }
   }

-  llvm_unreachable(
-      "Unknowns SCEV was neither parameter nor a valid instruction.");
+  if (isa<ConstantPointerNull>(Expr->getValue())) {
+    isl::val v{Ctx, 0};
+    isl::space Space{Ctx, 0, NumIterators};
+    isl::local_space ls{Space};
+    return getPWACtxFromPWA(isl::aff(ls, v));
+  }
+
+  llvm_unreachable("Unknowns SCEV was neither a parameter, a constant nor a "
+                   "valid instruction.");
 }

 PWACtx SCEVAffinator::complexityBailout() {
diff --git a/polly/lib/Support/SCEVValidator.cpp b/polly/lib/Support/SCEVValidator.cpp
index 94b55167a9b4..0e0ec7358571 100644
--- a/polly/lib/Support/SCEVValidator.cpp
+++ b/polly/lib/Support/SCEVValidator.cpp
@@ -461,6 +461,11 @@ public:
       }
     }

+    if (Expr->getType()->isPointerTy()) {
+      if (isa<ConstantPointerNull>(V))
+        return ValidatorResult(SCEVType::INT); // "int"
+    }
+
     return ValidatorResult(SCEVType::PARAM, Expr);
   }
 };
diff --git a/polly/test/Isl/CodeGen/partial_write_impossible_restriction.ll b/polly/test/Isl/CodeGen/partial_write_impossible_restriction.ll
index e4c2ce20b82b..3b17518a3ef4 100644
--- a/polly/test/Isl/CodeGen/partial_write_impossible_restriction.ll
+++ b/polly/test/Isl/CodeGen/partial_write_impossible_restriction.ll
@@ -7,7 +7,7 @@
 ;
 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"

-define void @partial_write_impossible_restriction() {
+define void @partial_write_impossible_restriction(i32* %.pn) {
 entry:
   br i1 undef, label %invoke.cont258, label %cond.true.i.i.i.i1007

@@ -15,7 +15,6 @@ cond.true.i.i.i.i1007:
   br label %invoke.cont258

 invoke.cont258:
-  %.pn = phi i32* [ null, %cond.true.i.i.i.i1007 ], [ null, %entry ]
   br label %invoke.cont274

 invoke.cont274:                                   ; preds = %invoke.cont258
@@ -49,11 +48,11 @@ if.then.i.i1141.loopexit:                         ; preds = %cond.end


 ; CHECK-LABEL: polly.stmt.cond.false:
-; CHECK:         %polly.access..pn2 = getelementptr i32, i32* %.pn, i64 %polly.indvar
-; CHECK:         store i32 %cond.in.sroa.speculate.load.cond.false_p_scalar_, i32* %polly.access..pn2, align 4, !alias.scope !0, !noalias !2
+; CHECK:         %polly.access..pn{{[0-9]*}} = getelementptr i32, i32* %.pn, i64 %polly.indvar
+; CHECK:         store i32 %cond.in.sroa.speculate.load.cond.false_p_scalar_, i32* %polly.access..pn{{[0-9]*}}, align 4, !alias.scope !0, !noalias !2
 ; CHECK:         br label %polly.merge

-; CHECK-LABEL: polly.stmt.cond.false11:
-; CHECK:         %polly.access..pn14 = getelementptr i32, i32* %.pn, i64 0
-; CHECK:         store i32 %cond.in.sroa.speculate.load.cond.false_p_scalar_13, i32* %polly.access..pn14, align 4, !alias.scope !0, !noalias !2
-; CHECK:         br label %polly.stmt.cond.end15
+; CHECK-LABEL: polly.stmt.cond.false{{[0-9]*}}:
+; CHECK:         %polly.access..pn{{[0-9]*}} = getelementptr i32, i32* %.pn, i64 0
+; CHECK:         store i32 %cond.in.sroa.speculate.load.cond.false_p_scalar_{{[0-9]*}}, i32* %polly.access..pn{{[0-9]*}}, align 4, !alias.scope !0, !noalias !2
+; CHECK:         br label %polly.stmt.cond.end{{[0-9]*}}
diff --git a/polly/test/Isl/CodeGen/scev_looking_through_bitcasts.ll b/polly/test/Isl/CodeGen/scev_looking_through_bitcasts.ll
index 1012e23cd3a2..ea7a9b7976dc 100644
--- a/polly/test/Isl/CodeGen/scev_looking_through_bitcasts.ll
+++ b/polly/test/Isl/CodeGen/scev_looking_through_bitcasts.ll
@@ -31,7 +31,8 @@ bitmap_element_allocate.exit:
 }


-; CHECK:       polly.stmt.cond.end73.i:
-; CHECK-NEXT:   %0 = bitcast %structty** %b.s2a to i8**
-; CHECK-NEXT:   store i8* undef, i8** %0
+; CHECK:      polly.stmt.cond.end73.i:
+; CHECK-NEXT:   %scevgep = getelementptr i8, i8* null, i64 %a
+; CHECK-NEXT:   %scevgep1 = bitcast i8* %scevgep to %structty*
+; CHECK-NEXT:   store %structty* %scevgep1, %structty** %b.s2a, align 8
 ; CHECK-NEXT:   br label %polly.exiting
lebedev.ri marked 4 inline comments as done.

This is my draft suggestion for changes required in Polly for this change. The main problem is that isZero() does not recognize a SCEVUnknown-wrapped ConstantNullExpr.

<...>

@Meinersbur Thank you! Applied.

Meinersbur added inline comments.Mar 8 2021, 10:52 AM
llvm/lib/Analysis/ScalarEvolution.cpp
1076

typo is still there

A GlobalValuewould but such a constant, but why handle it differently than a local value?

polly/lib/Analysis/ScopBuilder.cpp
1764

I used X to make a quick patch, maybe you can find a better name.

lebedev.ri added inline comments.Mar 8 2021, 10:55 AM
llvm/lib/Analysis/ScalarEvolution.cpp
1076

Because if we allow ConstantExpr::getPtrToInt() to return ptrtoint constant expression,
getSCEV() will immediately ask createSCEV() to model it as a SCEV expression,
which will result in calling ScalarEvolution::getPtrToIntExpr(),
which will then ask ConstantExpr::getPtrToInt(), which will then return ptrtoint constant expression,
getSCEV() will immediately ask createSCEV() to model it as a SCEV expression,
which will result in calling ScalarEvolution::getPtrToIntExpr(),
which will then ask ConstantExpr::getPtrToInt(), which will then return ptrtoint constant expression,
getSCEV() will immediately ask createSCEV() to model it as a SCEV expression,
which will result in calling ScalarEvolution::getPtrToIntExpr(),
which will then ask ConstantExpr::getPtrToInt(), which will then return ptrtoint constant expression,
getSCEV() will immediately ask createSCEV() to model it as a SCEV expression,
which will result in calling ScalarEvolution::getPtrToIntExpr(),
which will then ask ConstantExpr::getPtrToInt(), which will then return ptrtoint constant expression,
getSCEV() will immediately ask createSCEV() to model it as a SCEV expression,
which will result in calling ScalarEvolution::getPtrToIntExpr(),

xbolva00 added inline comments.
llvm/test/Transforms/LoopVectorize/X86/cost-model-assert.ll
19

Maybe adjust testcase?

llvm/test/Transforms/LoopVectorize/pointer-induction.ll
15

Worse

lebedev.ri added inline comments.Mar 8 2021, 11:00 AM
llvm/lib/Analysis/ScalarEvolution.cpp
1076

Edit:

IIUC, this is to reduce ptr2int(int2ptr(x)) -> x?

Hm, that's funny. I thought i replied to that question yesterday, but the inline comment is gone.bold text

A GlobalValuewould but such a constant, but why handle it differently than a local value?

Mainly we want this so that if we call ScalarEvolution::getPtrToIntExpr()
on a SCEVUnknown that is ConstantPointerNull, we don't end up with a
SCEVPtrToIntCast of an SCEVUnknown of a ConstantPointerNull,
but with a nice SCEVConstant with a value of 0.

lebedev.ri marked an inline comment as done.Mar 8 2021, 11:05 AM
lebedev.ri added inline comments.
llvm/test/Transforms/LoopVectorize/pointer-induction.ll
15

Yep, and that actually highlights the general class of issues that i want to deal with,
this patch is a preparatory cleanup before that.

Meinersbur added inline comments.Mar 9 2021, 5:12 AM
llvm/lib/Analysis/ScalarEvolution.cpp
1076

Mainly we want this so that if we call ScalarEvolution::getPtrToIntExpr() on a SCEVUnknown that is ConstantPointerNull [...]

Why not test if (auto *PC = dyn_cast<ConstantPointerNull>(U->getValue())) specifically?

lebedev.ri marked an inline comment as done.Mar 9 2021, 5:20 AM
lebedev.ri added inline comments.
llvm/lib/Analysis/ScalarEvolution.cpp
1076

That would be conservatively correct for sure, yes.
But i'm just not sure as to why should we make such a restriction?

Meinersbur added inline comments.Mar 9 2021, 11:13 PM
llvm/lib/Analysis/ScalarEvolution.cpp
1076

Because does not match what the code intends to do and leaves room for bugs caused by unintentionally broaden what it should apply to. Looking at the code I was wondering how it would constant fold a GlobalValue, but apparently with OnlyIfReduced=true it returns nullptr in such cases (is it guaranteed to? What does is "ptrtoint(g + 0)" return?). If it would fold to something still involving a ptrtoint expression, it would go into the endless recursion.

Please also update the comment that the intention is (only) normalize a ptrtoint(NULL) to a 0 constant and that it relies on ConstantExpr::getPtrToInt to never return a ptr2int expression itself, before I LGTM this patch.

Meinersbur added inline comments.Mar 10 2021, 1:08 PM
llvm/lib/Analysis/ScalarEvolution.cpp
1075–1080

Alternatively, I suggest we point-out that SCEV canonicalization is deferred to LLVM's ConstantFold and check that it really has been removed.

lebedev.ri marked 4 inline comments as done.

@mkazantsev @efriedma any thoughts here? Does this look sane on it's own.

@Meinersbur after thinking about it, regardless of whether or not we should have that constant folding,
it is probably best to minimize this patch, and "only" move null handling from createSCEV()
into getPtrToIntExpr(), without adding more general pointer constant handling.

polly/lib/Analysis/ScopBuilder.cpp
1764

Let's go with Unknown, not sure if better?

Meinersbur accepted this revision.Mar 12 2021, 8:49 AM

LGTM, thank you.

polly/lib/Analysis/ScopBuilder.cpp
1764

Find with me.

This revision is now accepted and ready to land.Mar 12 2021, 8:49 AM
This revision was landed with ongoing or failed builds.Mar 12 2021, 11:12 AM
This revision was automatically updated to reflect the committed changes.

This change appears to have broken the UBSan bot: https://lab.llvm.org/buildbot/#/builders/85/builds/3062/steps/7/logs/stdio

clang++: /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5169: llvm::BasicBlock::iterator {anonymous}::LSRInstance::AdjustInsertPositionForExpand(llvm::BasicBlock::iterator, const {anonymous}::LSRFixup&, const {anonymous}::LSRUse&, llvm::SCEVExpander&) const: Assertion `!isa<PHINode>(LowestIP) && !LowestIP->isEHPad() && !isa<DbgInfoIntrinsic>(LowestIP) && "Insertion point must be a normal instruction"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang++ -DNDEBUG -D_GNU_SOURCE -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_LINK_PTHREAD_LIB -D_LIBCPP_LINK_RT_LIB -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/libcxx/src -I/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/libcxx/src -Iinclude -I/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/include -Iprojects/libcxx/include/c++build -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -fno-omit-frame-pointer -gline-tables-only -fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all -fsanitize-blacklist=/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/utils/sanitizers/ubsan_blacklist.txt -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DLIBCXX_BUILDING_LIBCXXABI -UNDEBUG -faligned-allocation -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -Wall -Wextra -W -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-ignored-attributes -Wno-error -I /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/libcxx_build_ubsan/include/c++/v1 -include /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/libcxx_build_ubsan/projects/libcxx/__config_site -std=c++2a -MD -MT projects/libcxx/src/CMakeFiles/cxx_static.dir/ios.instantiations.cpp.o -MF projects/libcxx/src/CMakeFiles/cxx_static.dir/ios.instantiations.cpp.o.d -o projects/libcxx/src/CMakeFiles/cxx_static.dir/ios.instantiations.cpp.o -c /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/libcxx/src/ios.instantiations.cpp
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/libcxx/src/ios.instantiations.cpp'.
4.	Running pass 'Loop Pass Manager' on function '@_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE7getlineEPclc'
5.	Running pass 'Loop Strength Reduction' on basic block '%invoke.cont'
 #0 0x000055e49af53b8c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x33bcb8c)
 #1 0x000055e49af518c4 llvm::sys::RunSignalHandlers() (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x33ba8c4)
 #2 0x000055e49af51b3b llvm::sys::CleanupOnSignal(unsigned long) (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x33bab3b)
 #3 0x000055e49aeb4e98 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #4 0x00007fb68097e730 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12730)
 #5 0x00007fb6802647bb raise (/lib/x86_64-linux-gnu/libc.so.6+0x377bb)
 #6 0x00007fb68024f535 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22535)
 #7 0x00007fb68024f40f (/lib/x86_64-linux-gnu/libc.so.6+0x2240f)
 #8 0x00007fb68025d102 (/lib/x86_64-linux-gnu/libc.so.6+0x30102)
 #9 0x000055e49ad467ff (anonymous namespace)::LSRInstance::Expand((anonymous namespace)::LSRUse const&, (anonymous namespace)::LSRFixup const&, (anonymous namespace)::Formula const&, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, false>, llvm::SCEVExpander&, llvm::SmallVectorImpl<llvm::WeakTrackingVH>&) const LoopStrengthReduce.cpp:0:0
#10 0x000055e49ad52b02 (anonymous namespace)::LSRInstance::ImplementSolution(llvm::SmallVectorImpl<(anonymous namespace)::Formula const*> const&) LoopStrengthReduce.cpp:0:0
#11 0x000055e49ad581c1 (anonymous namespace)::LSRInstance::LSRInstance(llvm::Loop*, llvm::IVUsers&, llvm::ScalarEvolution&, llvm::DominatorTree&, llvm::LoopInfo&, llvm::TargetTransformInfo const&, llvm::AssumptionCache&, llvm::TargetLibraryInfo&, llvm::MemorySSAUpdater*) LoopStrengthReduce.cpp:0:0
#12 0x000055e49ad5a81e ReduceLoopStrength(llvm::Loop*, llvm::IVUsers&, llvm::ScalarEvolution&, llvm::DominatorTree&, llvm::LoopInfo&, llvm::TargetTransformInfo const&, llvm::AssumptionCache&, llvm::TargetLibraryInfo&, llvm::MemorySSA*) LoopStrengthReduce.cpp:0:0
#13 0x000055e49ad5d33a (anonymous namespace)::LoopStrengthReduce::runOnLoop(llvm::Loop*, llvm::LPPassManager&) LoopStrengthReduce.cpp:0:0
#14 0x000055e49a03b123 llvm::LPPassManager::runOnFunction(llvm::Function&) (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x24a4123)
#15 0x000055e49a7412bc llvm::FPPassManager::runOnFunction(llvm::Function&) (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x2baa2bc)
#16 0x000055e49a741de9 llvm::FPPassManager::runOnModule(llvm::Module&) (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x2baade9)
#17 0x000055e49a740c11 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x2ba9c11)
#18 0x000055e49b207e57 (anonymous namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) BackendUtil.cpp:0:0
#19 0x000055e49b20b075 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x3674075)
#20 0x000055e49be46e53 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) crtstuff.c:0:0
#21 0x000055e49c959709 clang::ParseAST(clang::Sema&, bool, bool) (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x4dc2709)
#22 0x000055e49be45c88 clang::CodeGenAction::ExecuteAction() (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x42aec88)
#23 0x000055e49b7f0701 clang::FrontendAction::Execute() (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x3c59701)
#24 0x000055e49b78f921 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x3bf8921)
#25 0x000055e49b8b4ac0 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x3d1dac0)
#26 0x000055e498bedae2 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x1056ae2)
#27 0x000055e498bea0e7 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#28 0x000055e49b647055 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#29 0x000055e49aeb5002 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x331e002)
#30 0x000055e49b64838c clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (.part.185) Job.cpp:0:0
#31 0x000055e49b621486 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x3a8a486)
#32 0x000055e49b621f47 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x3a8af47)
#33 0x000055e49b62a401 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x3a93401)
#34 0x000055e498b1b589 main (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0xf84589)
#35 0x00007fb68025109b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409b)
#36 0x000055e498be9bba _start (/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang+++0x1052bba)

Please take a look.

This change appears to have broken the UBSan bot: https://lab.llvm.org/buildbot/#/builders/85/builds/3062/steps/7/logs/stdio

<...>

Please take a look.

Looking..
It would be very good for bots to actually provide reproducers that were already automatically produced.