[llvm] 1fd980d - Revert "AttributorAttributes: avoid a crashing on bad alignments"
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 23 09:08:36 PST 2022
Author: Arthur Eubanks
Date: 2022-02-23T09:08:03-08:00
New Revision: 1fd980de04eda1bead75263a67e6e3bf8c4ebd00
URL: https://github.com/llvm/llvm-project/commit/1fd980de04eda1bead75263a67e6e3bf8c4ebd00
DIFF: https://github.com/llvm/llvm-project/commit/1fd980de04eda1bead75263a67e6e3bf8c4ebd00.diff
LOG: Revert "AttributorAttributes: avoid a crashing on bad alignments"
This reverts commit 70ff6fbeb9b5acb4995dc42286954b762d0937fd.
Breaks bots, e.g. http://45.33.8.238/linux/69375/step_12.txt.
Added:
Modified:
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Transforms/Attributor/heap_to_stack.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index ba986a65e0201..c94f38687b219 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -38,14 +38,12 @@
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
-#include "llvm/IR/Value.h"
#include "llvm/IR/NoFolder.h"
#include "llvm/Support/Alignment.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/IPO/ArgumentPromotion.h"
#include "llvm/Transforms/Utils/Local.h"
@@ -6358,8 +6356,7 @@ ChangeStatus AAHeapToStackFunction::updateImpl(Attributor &A) {
continue;
if (Value *Align = getAllocAlignment(AI.CB, TLI)) {
- Optional<APInt> APAlign = getAPInt(A, *this, *Align);
- if (!APAlign) {
+ if (!getAPInt(A, *this, *Align)) {
// Can't generate an alloca which respects the required alignment
// on the allocation.
LLVM_DEBUG(dbgs() << "[H2S] Unknown allocation alignment: " << *AI.CB
@@ -6367,13 +6364,6 @@ ChangeStatus AAHeapToStackFunction::updateImpl(Attributor &A) {
AI.Status = AllocationInfo::INVALID;
Changed = ChangeStatus::CHANGED;
continue;
- } else {
- if (APAlign->ugt(llvm::Value::MaximumAlignment) || !APAlign->isPowerOf2()) {
- LLVM_DEBUG(dbgs() << "[H2S] Invalid allocation alignment: " << APAlign << "\n");
- AI.Status = AllocationInfo::INVALID;
- Changed = ChangeStatus::CHANGED;
- continue;
- }
}
}
diff --git a/llvm/test/Transforms/Attributor/heap_to_stack.ll b/llvm/test/Transforms/Attributor/heap_to_stack.ll
index 9741df2034ce9..73f6887204647 100644
--- a/llvm/test/Transforms/Attributor/heap_to_stack.ll
+++ b/llvm/test/Transforms/Attributor/heap_to_stack.ll
@@ -218,20 +218,6 @@ define void @test3c(i64 %alignment) {
ret void
}
-; leave alone a constant-but-invalid alignment
-define void @test3d(i8* %p) {
-; CHECK-LABEL: define {{[^@]+}}@test3d
-; CHECK-SAME; (i8* nocapture [[P:%.*]]) {
-; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @aligned_alloc(i64 allocalign noundef 33, i64 noundef 128)
-; CHECK: tail call void @free(i8* noalias nocapture [[TMP1]])
-; CHECK-NEXT: ret void
-;
- %1 = tail call noalias i8* @aligned_alloc(i64 allocalign 33, i64 128)
- tail call void @nofree_arg_only(i8* %1, i8* %p)
- tail call void @free(i8* %1)
- ret void
-}
-
declare noalias i8* @calloc(i64, i64)
define void @test0() {
More information about the llvm-commits
mailing list