File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,24 @@ void SplitBasicBlock::split(Function *f) {
123123 last = test[i];
124124 if (toSplit->size () < 2 )
125125 continue ;
126+
127+ /* TODO: find a real fix or try with the probe-stack inline-asm when its
128+ * ready. See https://github.com/Rust-for-Linux/linux/issues/355.
129+ * Sometimes moving an alloca from the entry block to the second block
130+ * causes a segfault when using the "probe-stack" attribute (observed with
131+ * with Rust programs). To avoid this issue we just split the entry block
132+ * after the allocas in this case.
133+ */
134+ if (f->hasFnAttribute (" probe-stack" ) &&
135+ #if LLVM_VERSION_MAJOR < 13
136+ (curr == &curr->getParent ()->getEntryBlock ())
137+ #else
138+ curr->isEntryBlock ()
139+ #endif
140+ && isa<AllocaInst>(it)) {
141+ continue ;
142+ }
143+
126144 toSplit = toSplit->splitBasicBlock (it, toSplit->getName () + " .split" );
127145 }
128146
You can’t perform that action at this time.
0 commit comments